Solved

c# Webpage Setting the timeout

Posted on 2011-09-22
10
225 Views
Last Modified: 2013-12-17
I have a website that calls different pages. I need to set the time out for each page, but I dot know where to set this value or where to look for it.

And is there a way to change the time out once the page has started?

For example if the initial time out is 3 mins,
but once the user logs in depending on who they will have a different time alloctated for the time out.
0
Comment
Question by:jhacharya
  • 6
  • 4
10 Comments
 
LVL 5

Assisted Solution

by:zvytas
zvytas earned 500 total points
ID: 36580813
I assume you need to set script execution timeout, not session timeout. This can be done as follows:

// 60 seconds = 1 minute
Server.ScriptTimeout = 60;

You can put this code in the Page_Load for each page OR in the global.asax.
0
 
LVL 2

Assisted Solution

by:jhacharya
jhacharya earned 0 total points
ID: 36580978
this doesnt seem to be working

I have a log in page which has no time out setting so i presume that there is some default

this log in page calls my data page and this is where I wanted to set a time out

I placed the Server.ScriptTimeout = 1; in the Page_load section, but this does not time out the page.

I am testing this from  visual studio using debugging (F5) so i dont knwo if doing this ignores the time out error. I also can not find any global.asax page in my pjoect

        protected void Page_Load(object sender, EventArgs e)
        {
           
            try
            {
                Server.ScriptTimeout = 1;
..
..
0
 
LVL 5

Accepted Solution

by:
zvytas earned 500 total points
ID: 36581043
I would guess this is because debug attribute in the web.config is set to true. See the following for more details:

http://blogs.msdn.com/b/paraga/archive/2006/05/08/592417.aspx
0
 
LVL 2

Assisted Solution

by:jhacharya
jhacharya earned 0 total points
ID: 36581282
I have set the             <compilation debug="false" targetFramework="4.0">
            </compilation>
in the webc.config file but still no luck with tryng to test the time out...

i am not sure how i can test this out before i relese the web page. I do not have a test wb server to deploy. I only have a production env which is live and my development ....

is there anything else i can try?


here is my wec.config file in whole

<?xml version="1.0"?>
<configuration>
      <appSettings/>
      <connectionStrings/>
      <system.web>
            <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
            <compilation debug="false" targetFramework="4.0">
            </compilation>
            <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
            <authentication mode="Windows"/>
            <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
            <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/></system.web>
      <!--
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
</configuration>
0
 
LVL 5

Assisted Solution

by:zvytas
zvytas earned 500 total points
ID: 36581298
Are you running the website in the Debug build configuration? I would try changing it to Release.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 2

Assisted Solution

by:jhacharya
jhacharya earned 0 total points
ID: 36581541
i cant seem to do what you are suggesting I test the website directly from Visual studio 2010, I have tried with the debug option off ... i am not sure how to test this change from my pc.

0
 
LVL 5

Assisted Solution

by:zvytas
zvytas earned 500 total points
ID: 36581586
So are you running the website in Debug configuration?
0
 
LVL 2

Assisted Solution

by:jhacharya
jhacharya earned 0 total points
ID: 36582055
no i use the debug off which is done by using cntrl + F5
0
 
LVL 2

Author Comment

by:jhacharya
ID: 37693082
awarding poibnts for effort
0
 
LVL 2

Author Closing Comment

by:jhacharya
ID: 37708851
closing our question as no one could really find the issue
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now