Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-10-2005, 07:21 PM   PM User | #1
seemagaur
New to the CF scene

 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
seemagaur is an unknown quantity at this point
Question urgent: session timeout occurs unexpectedly(given both web.config & global.asax code)

I am doing a website with asp.net. i have used session variable in my GLOBAL.ASAX file. the code is given below:

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Session.Timeout = 100
Session("Loggedin") = "No"
End Sub

Sub Session_End(Sender As Object, E As EventArgs)
' Code that runs when a session ends

Session.Abandon()
Response.Redirect("index.aspx")
End Sub
----------------------------------------
And in WEB.CONFIG i have used the following information inside <system.web> tag :

<sessionState mode="InProc"
cookieless="false"
timeout="100"/>

<pages buffer="false"
enableSessionState="true"
smartNavigation="false"
autoEventWireup="true"
validateRequest="false"
enableViewStateMac = "false"
enableViewState="true"/>

Even after using these things when i login suddenlt after a min i am logged out though i am adding records at the moment.
Please please tell me where i am going wrong. I have to give this project to my boss soon and i am stuck here since i am not

able find out the problem why the session expires and i am logged out and send back to the login page.
Seema

(Mail ID: gaur.seema at rediffmail.com)
seemagaur is offline   Reply With Quote
Old 10-11-2005, 11:42 AM   PM User | #2
Cipher
Regular Coder

 
Cipher's Avatar
 
Join Date: Dec 2004
Posts: 123
Thanks: 0
Thanked 0 Times in 0 Posts
Cipher is an unknown quantity at this point
well try only to change the timeout in the web.config, and leave other settings to its default, http://forums.asp.net try this site, it can be helpful.
Cipher is offline   Reply With Quote
Old 10-14-2005, 08:08 PM   PM User | #3
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
try using the web.config instead of session variable to restrict access.


web.config sample
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
    <system.web>
        <sessionState mode="InProc"
                        stateConnectionString="tcpip=127.0.0.1:42424"
                        sqlConnectionString="data source=127.0.0.1;trusted_connection=true"
                        cookieless="false"
                        timeout="20" />
        <customErrors mode="Off" />
        <authentication mode="Forms">
                <forms name=".ASPXAUTH"
                        loginUrl="index.aspx"
                        protection="All"
                        timeout="30"
                        path="/" />
        </authentication>
        <authorization>
            <deny users="?" />
        </authorization>
       <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    </system.web>
    <location path="register.aspx">
        <system.web>
            <authorization>
                <allow users="?"/>
            </authorization>        
        </system.web>
    </location>
    <location path="default.aspx">
        <system.web>
            <authorization>
                <allow users="?"/>
            </authorization>
        </system.web>
    </location>
    <location path="contact.aspx">
        <system.web>
            <authorization>
                <allow users="?"/>
            </authorization>
        </system.web>
    </location>
    <location path="getHint.aspx">
        <system.web>
            <authorization>
                <allow users="?"/>
            </authorization>
        </system.web>
    </location>    
    <location path="admin">
        <system.web>
            <authorization>
                <deny users="?"/>
            </authorization>
        </system.web>
    </location>
</configuration>

Key
Restricts access to pages not allowed below
annonymous access allowed
Restricted Directory
miranda is offline   Reply With Quote
Old 10-26-2005, 12:54 AM   PM User | #4
hvlasta
New to the CF scene

 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
hvlasta is an unknown quantity at this point
Processing .Net config

For administration and processing .Net config files for Win or Web applications look at:
http://idmnetcontrols.com/
hvlasta is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:59 PM.


Advertisement
Log in to turn off these ads.