P
Peter
One question that came up is that I am writing an ASP.NET page that has
some custom (C#) web controls. Since I am not afforded the ability to write
to the console for debugging/information purposes I thought I would simply
write things to a logfile. Well I instantantiated my custom C# class outside
the page_load function thinking it would only get constructed once and then
get skipped over on refreshes of the IE browser. However apparently there
seems to be no way around this. Basically I want to have the class as global
class that some of the other C# script functions can access.
My thinking was I could open up a TextWriter in the constructor of the
global
class and then close the file in the destructor. My thinking is flawed in a
couple
of points. I was thinking that the class would get instantiated once if it
was outside
of the page_load and the destructor would kick off if you left the page for
another
page. So my new tack is to open the file, insert my messages then quickly
close
it back up. Seem reasonable or is it doable to instantiate a class once upon
initially loading of a page and have it available throughout the C# script?
BTW, this C# scripting seems to be dissimilar to plain old C# applications.
I was trying
to call DateTime.Now but couldn't. Should I have available to me all the
functions
that are available in a plain old C# windows application? Are there any good
reference
materials on the C# (ASP.NET) scripting particulars that someone could
recommend?
Any information would be greatly appreciated!
Thanks,
Peter
some custom (C#) web controls. Since I am not afforded the ability to write
to the console for debugging/information purposes I thought I would simply
write things to a logfile. Well I instantantiated my custom C# class outside
the page_load function thinking it would only get constructed once and then
get skipped over on refreshes of the IE browser. However apparently there
seems to be no way around this. Basically I want to have the class as global
class that some of the other C# script functions can access.
My thinking was I could open up a TextWriter in the constructor of the
global
class and then close the file in the destructor. My thinking is flawed in a
couple
of points. I was thinking that the class would get instantiated once if it
was outside
of the page_load and the destructor would kick off if you left the page for
another
page. So my new tack is to open the file, insert my messages then quickly
close
it back up. Seem reasonable or is it doable to instantiate a class once upon
initially loading of a page and have it available throughout the C# script?
BTW, this C# scripting seems to be dissimilar to plain old C# applications.
I was trying
to call DateTime.Now but couldn't. Should I have available to me all the
functions
that are available in a plain old C# windows application? Are there any good
reference
materials on the C# (ASP.NET) scripting particulars that someone could
recommend?
Any information would be greatly appreciated!
Thanks,
Peter