'debug' mode and session question

G

Guest

Hi everyone!

1) How can I include 'debug' mode code in my asp.net 2005 project?
i.e. in visual basic 6 (where I come from) the developer could check if the
application was running from within the IDE and
write some code that would run only then.
How can I do that in asp.net 2005?

I've seen an example here:
http://weblogs.asp.net/scottgu/arch...ow-Detailed-Error-Messages-to-Developers.aspx
that is checking the user role, but couldn't make it work,
I logon to a domain and can't figure out what role the user is in,
but, besides that, insn't aspnet user the one that logs on?

Tried to check is debug="true" is defined in web.config,
but couldn't figure a way to check this,
how do I check if debug is equal to true or false in web.config?

2) What I would like to do using the above is extend the session to 500
minutes for example,
when developing and let it to 20 minutes for web site visitors.
The above example talks about global.asax code,
but I have session timeout defined in web.config too,
so, which one is loaded first?
web.config or global.asax?
Is it possible to override the session timeout defined in web.config?
And how?
I would like it to never expire,
is it a good idea to set it to 500 minutes or is there a more 'elegant' way
to do that?

Thanks in advance!
 
D

dtarczynski

Hi everyone!

1) How can I include 'debug' mode code in my asp.net 2005 project?
i.e. in visual basic 6 (where I come from) the developer could check if the
application was running from within the IDE and
write some code that would run only then.
How can I do that in asp.net 2005?

I've seen an example here:http://weblogs.asp.net/scottgu/archive/2006/08/12/Tip_2F00_Trick_3A00...
that is checking the user role, but couldn't make it work,
I logon to a domain and can't figure out what role the user is in,
but, besides that, insn't aspnet user the one that logs on?

Tried to check is debug="true" is defined in web.config,
but couldn't figure a way to check this,
how do I check if debug is equal to true or false in web.config?

2) What I would like to do using the above is extend the session to 500
minutes for example,
when developing and let it to 20 minutes for web site visitors.
The above example talks about global.asax code,
but I have session timeout defined in web.config too,
so, which one is loaded first?
web.config or global.asax?
Is it possible to override the session timeout defined in web.config?
And how?
I would like it to never expire,
is it a good idea to set it to 500 minutes or is there a more 'elegant' way
to do that?

Thanks in advance!

Setting session expire to 500 minutes insn't good way to anything :)
Think about performance.
To check that Debug mode is enabled you can write:

if (HttpContext.Current.IsDebuggingEnabled)
\\ do something you want

Regards
Dariusz Tarczyñski
 
G

Guest

Thank you very much!
So, what could you suggest about session when doing development?
Leave it to 20 minutes both in development and production building?

and...
what about:

so, which one is loaded first?
web.config or global.asax?
 
D

dtarczynski

Thank you very much!
So, what could you suggest about session when doing development?
Leave it to 20 minutes both in development and production building?

and...
what about:

so, which one is loaded first?
web.config or global.asax?

You should leave this value with default 20 mintues in web.config. It
should be enought. If you have longer times (and then more memory
consumption - each session consumes memory) you should thinking about
storing sessions in SesionStateServer (in database). Thats my opinion.

Regards
Dariusz Tarczynski
 
D

dtarczynski

You should leave this value with default 20 mintues in web.config. It
should be enought. If you have longer times (and then more memory
consumption - each session consumes memory) you should thinking about
storing sessions in SesionStateServer (in database). Thats my opinion.

Regards
Dariusz Tarczynski

I mean Session StateSterver as special service in server (i wrote in
database - my mistake). Ofcourse StateServer handles sessions in
memory too, that why you should thinking about handling sesions in
database :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,102
Latest member
GregoryGri
Top