|
Hi,
Does any one know where I can read a good article on the web.config file? I'm still stuck on my problem, and no-one can seem to help me. I can't seem to find a good article as well.
Let me describe my problem again.
My website has 2 login sections, namely:
wwwroot/members/login.aspx and
wwwroot/admin/login.aspx
Only members can access the members section, and only admin people can access the admin directory. Each section has it's own directory structure.
If someone tries to access a page in the members directory, then he/she should be directed to the /members/login.aspx page, and if he/she wants to access an admin page, then he/she is directed to /admin/login.aspx.
I'm not sure how to set this in the web config file, and if this is the best place to set it. I need this kind of info, and must the web.config file lie in wwwroot, or under /admin/, or under the /members/ section.
How do I modify my web.config file(s) to handle this.
Any online docs/books will be appreciate!!
I hope someonme can help!!
Regards,
Brendan
|
|
|
|
|
|
Hi guys & girls,
I've a problem with threads. I write a Windows Service which handles files. The processing can take some time, so I need to use threads, as some of the files have to be processes as fast and can not wait while other files are getting processed.
My application is designed as follows:
I've three modules. The first module reads and writes "internal" files. The third module reads and writes "external" files. The second modle converts the files, either internal or external, into the other format.
So when the first module gets a file, it gives an object representing the file to the second module, where the file is converted and then the second module gives the object to the third module where it is saved. For external files its the same, just the other way round.
So I thought about using either FileSystemWatcher or a Timer for checking for new files on both sides and then start a thread for each file. But with this the method calls will start in the first module and stop in the last.
So I thouhgt about a different approach. I could create some buffer between the modules and on each side of the buffer a thread looking for new files in the buffer. In the converter module, where the time consuming part takes place I could then start new threads for each file, but this threads would stay inside the module.
I just don't know which approach is better or maybe both of them are bullsh**, so could someone please give me some help with this? I want to create a clean application but I haven't worked much with threads and so I just don't know what would be better. With the second approach I could control the number of working threads better, but I'm just not shure if it is a good method, so please help me with that!
greetings
Stampede
-- modified at 9:20 Tuesday 6th September, 2005
|
|
|
|
|
Depending upon how many files you may be converting simultaneously, you could run into slower performance because of too many threads. So, the ideal solution would be to use a thread pool of some kind. And here, you're in luck! There is an easy-to-use thread pool built into the .NET Framework.
With no more information that what you've described, I would suggest that you do something similar to the converter-thread idea. Combine this with the built-in thread pool capabilities of the .NET Framework.
To do this, either create events in the first and third modules, having the converter subscribe to them. Or, create a delegate in the converter module, which the first and third modules can access. Then, instead of simply calling the delegate directly, use the BeginInvoke() method. (Also, make sure you handle things properly with EndInvoke when the callback is triggered. Otherwise, you can have leaks.) This method will use the built-in thread pool to execute the function used by the delegate!
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Both the system.timers.timer and the FileSystemWatcher fires events from the thread pool, so your first approach is going to be easier to code and maintain. You shouldn't have to create or manage threads at all in your app. Just write your event handlers like you normally would and concurrent events will be fired on seperate threads. The only thing you have to look out for is syncronization of shared resources.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
i know this isnt the appropriate place to post this but sice i see a large number of people using this forum, i decided to go ahead. I have a lot of code snipptets lying in my computer which i require regulary. Is there some of code management software. I once used to use Artifact Desktop a.k.a CodeJack but it was shut down. Anything similar?
|
|
|
|
|
Hi!
I have a big problem, my VS 2003 crach all the time.
In the loggbook I can see:
Faulting application devenv.exe, version 7.10.3077.0, faulting module ntdll.dll, version 5.1.2600.2180, fault address 0x00043345.
Serching on the net, I can understand that I am not the only one,
and somone was talking about a hotfix.
Is there anyone, who can help me???
Thanks
Benni Svensson
info@saw.se
|
|
|
|
|
I've created a sqldataadapter, stored procedures, and a data set using the VS2003 IDE Wizard based on a select command with a single paramter; search and updates work fine. I've got non-null columns in my database so I had to create a new Datarow in the data set and update that to perform an insert. The problem is the follow-up fill (sqlDataAdapter1.Update(dsStaffPhysicians1) to repopulate the dataset errors. Any help would be greatly appreciated.
Code Snippet Follows=================================================
static void Main()
{
Application.Run(new Form1());
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
//Initialize Staff Physician Screen
SetupStaffPhysician();
menuItem2.Enabled = false;
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
//Exit Application
Application.Exit();
}
private void SetupStaffPhysician()
{
panel1.Visible = true;
this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding("SelectedIndex", this.dsStaffPhysicians1, "tblStaffPhysicians.docLicenseState"));
}
private void ClearStaffPhysicians()
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
comboBox1.SelectedIndex = 0;
}
private void btnSearch_Click(object sender, System.EventArgs e)
{
sqlDataAdapter1.SelectCommand.Parameters["@Param2"].Value = textBox3.Text;
dsStaffPhysicians1.Clear();
sqlDataAdapter1.Fill(dsStaffPhysicians1);
}
private void btnReset_Click(object sender, System.EventArgs e)
{
this.dsStaffPhysicians1.Clear();
ClearStaffPhysicians();
}
private void btnUpdate_Click(object sender, System.EventArgs e)
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].EndCurrentEdit();
sqlDataAdapter1.Update(dsStaffPhysicians1);
sqlDataAdapter1.Fill(dsStaffPhysicians1);
}
private void btnInsert_Click(object sender, System.EventArgs e)
{
try
{
ClearStaffPhysicians();
}
catch(Exception exp)
{
MessageBox.Show("Error 001 " + exp.Message);
}
}
private void btnCommit_Click(object sender, System.EventArgs e)
{
DataRow newStaffPhysician = dsStaffPhysicians1.Tables["tblStaffPhysicians"].NewRow();
newStaffPhysician["docLName"] = textBox3.Text;
newStaffPhysician["docFName"] = textBox1.Text;
newStaffPhysician["docMName"] = textBox2.Text;
newStaffPhysician["docLicenseState"] = comboBox1.SelectedIndex;
newStaffPhysician["docLicenseNumber"] = textBox4.Text;
newStaffPhysician["docUpin"] = textBox5.Text;
dsStaffPhysicians1.Tables["tblStaffPhysicians"].Rows.Add(newStaffPhysician);
sqlDataAdapter1.Update(dsStaffPhysicians1);
//Fill method will error!!
sqlDataAdapter1.Fill(dsStaffPhysicians1);
}
}
}
|
|
|
|
|
This may not fit with the parameters of your application design, but the examples show the Fill command being executed before the Update. (So you could move the Fill command to the top of your btnCommit_Click function.)
Also, for this type of problem, it is far more likely that you will get valuable help if you provide a detailed error message in your post.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hi
I need to free the memory occupied by xml document.
I tried to use this code inside button
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("c:/a.xml");
you can check for memory performance in windows task manager
I have already made one project The problem is coming in this xml loading
every time its creatting own instance and incraeasing the memory.
If any one has any idea to free momory
if some one give me example of relasing momory
thanks
|
|
|
|
|
Could you explain the setup a little more? The .NET Framework's garbage collection usually handles these things quite nicely. Unless you are loading many XML documents and keeping references to them (so the garbage collector thinks you still need them), you shouldn't have any problems.
As a side note, if you are processing many XML documents, and using them in a read-only fashion. You can gain performance by using either XmlReader or XPathDocument. (I prefer XPathDocument.)
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hi John,
In my project every time XML file is loaded and read thr Xml reader but when the form is closed it should be freed by memory but it does not happen its due to XmlDocument
I just for example tried to do inside the button i want that after pressing the button it should load and free the memory occupied by processor.
Do you have any idea you can tell me in class to load the XMlDocument and Unload XmlDocument
Thanks
sanjeev
|
|
|
|
|
It sounds like you are watching some sort of Windows memory tool (like TaskManager). This is not an accurate way to analyze memory usage in the .NET Framework. (It does not instantly free memory when you quit using a variable.) Read a few articles like this[^], and you'll have a better understanding of the real behavior of garbage collection in the .NET Framework.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hi,
I have written a web service and need to connect to that using win form. In Visual Studio 2003, when I try to add web reference using LAN IP, it works. But if I use internet IP for the same service/server/IIS/machine, Visual Studio gives a prompt for "Discovery Credential For Proxy Server".
What I need to provide there, or how can I get rid of this, please help.
- ashish
|
|
|
|
|
Hello dudes ?
I have another problem i use richtextbox to edit some text but i don't know how to insert multiple lines of text in that richtextbox but i need each line with its specific font and color attributes i used this code my friend gave me here is the code
<br />
string message = "Snouto : " + textBox1.Text;<br />
richTextBox1.Text += message + "\r\n";<br />
int pos = 0;<br />
while(pos < richTextBox1.TextLength)<br />
{<br />
int index = richTextBox1.Find(textBox1.Text,pos,RichTextBoxFinds.None);<br />
if(index == -1)<br />
break;<br />
richTextBox1.Select(index,textBox1.Text.Length);<br />
richTextBox1.SelectionFont = fontDialog1.Font;<br />
richTextBox1.SelectionColor = colorDialog1.Color;<br />
pos = index + RichTextBox1.TextLength;<br />
}<br />
textBox1.Clear();<br />
but this code when i write one sentence ok it changes its font and color but when i write again the same sentence it changes the color and font of the first sentence to the defaul color and font and then it gives the new same sentence the changes in font and color i need to insert multiple lines of text and give each one color and font without being changed if i inserted again the same sentences what can i do ?
Please help me
Miss With The Best And Die Like The Rest
-- modified at 7:17 Tuesday 6th September, 2005
|
|
|
|
|
That's because you're using Find to find the sentence in the text and it obviously is finding both the first and the new sentence. I'd suggest using another variable to store the *previous* index, looping till the last Find (until index returns -1) and then using the previous index to set the color stuff. Or, if there is something like LastIndexOf , you could use it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
can you give me simple code for this please
Miss With The Best And Die Like The Rest
|
|
|
|
|
Not compiled or tested, but you'll get the idea.
string message = "Snouto : " + textBox1.Text;
richTextBox1.Text += message + "\r\n";
int pos = 0;
int prevIndex = -1;
while(pos < richTextBox1.TextLength)
{
int index = richTextBox1.Find(textBox1.Text,pos,RichTextBoxFinds.None);
if(index == -1)
break;
prevIndex = index;
pos = index + RichTextBox1.TextLength;
}
index = prevIndex;
richTextBox1.Select(index,textBox1.Text.Length);
richTextBox1.SelectionFont = fontDialog1.Font;
richTextBox1.SelectionColor = colorDialog1.Color;
textBox1.Clear();
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
I am trying to record the user actions on forms as part of my exception handling.
I've set up a singleton object that records all the control events i'm interested in and it works fine for the single test form. The form registers itself in the constructor and unregisters itself on disposal.
Then i thought i'd be clever and create a base class, let's call it myFormBase. I put the line to register the controls in the constructor:
_controlWatcher.AddForm(this);
ControlWatcher takes an argument of type form, i've also tried type myFormBase, but when i look through the controls for the form I only get the controls present on the base class, not the controls on the actual form i have passed in.
Is there a way round this problem?
Thanks
Russell
|
|
|
|
|
You would need to have them, atleast as abstract properties, in the base class. Something like
abstract class MyFormBase
{
public abstract TextBox MyTextBox
{
get ;
}
}
class MyForm : MyFormBase
{
private TextBox textbox = new TextBox();
public override TextBox MyTextBox
{
get { return textbox; }
}
}
Or if all classes deriving from MyFormBase would have those controls, you can as well declare them in the base class itself.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I was trying to loop through the controls collection on the form rather than refernce controls directly. I think it was laziness on my part, i'll put a call in each form i create, instead.
Thanks for your help Senthil,
Russ
|
|
|
|
|
I have a newbie question about threading and controls,
I know the rule: "A control can not be accessed from a thread that is not the creator of that control"
But if I create a class which inherits from Form, and add new members which are not controls, can I access those members from any thread??
Thanks in advance
Use the force
|
|
|
|
|
Yes you can, you need to worry only about accessing/modifying controls. But you might still want to synchronize access to them using the lock statement.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
This is driving us mad, i'll try and keep it simple.
We have a custom control writtten in VB.Net compiled as a class library, this is added as a reference to a C# application, with the control being placed on its form.
They both have the same/similar root namespace eg:
CompanyName.Things.<the thing="">With me so far...the problem is that if at anytime after the component has been referenced the custom control changes, say for example adding a style enum to the control that can be set by designers, the forms that use this control complain about not being able to see the additions.
This is *most* true for our custom properties of the control that can be set by the designer.
Removing and re-referencing the component makes no difference, and of course i am sure the features being added are public available.
It seems (prove me wrong) that once a VB.Net custom control has been added to a C# application you can't make any changes to that custom control! That can't be correct surely.
I don't seem to have this problem if the custom control is written in C#.
Am i mad, what's the problem?
Si
|
|
|
|
|
How are you referencing the VB .NET library? Did you add it by browsing and selecting the dll (binary reference) or by selecting it from the Projects tab (in VS .NET) ? If it is the former and if Copy Local is set to true, then Visual Studio won't watch for modifications to the library, instead, it will simply use the local copy (that's what Copy Local does). My guess is that you added it as a binary reference, whereas for C# controls, you had them in the same project and therefore added them through the Projects tab.
You can try setting Copy Local to false (Right click on the reference in VS .NET, click Properties). Or, if the changes are very infrequent, you can manually copy the library to the C# project's bin/debug directory (or do it as a PreBuild step).
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|