Click here to Skip to main content
12,956,606 members (56,207 online)
Rate this:
 
Please Sign up or sign in to vote.
i have a snippet that a session has numeric content nd it incrise to 3 but when it receive to 3 it send to client.this session must time out in 1 minuet but until the session is not time out the program work correctly but when the session is expired and new session want create i get system.invalidoperationexception . i check session if its expierd i creat a new but when i want create new session i get system.invalidoperationexception if i select adress bar and reload page new session create but when i use window.location.reload() in client side for refresh my problem dont solve.i use history.go(0) and other method but dont work.whats the problem????
its my code :

string ip = HttpContext.Current.Request.UserHostAddress;
 

HttpContext failuser = HttpContext.Current;
failuser.Session.Timeout =1;
if (failuser != null)
{
    if (failuser.Session[ip] != null)
        failuser.Session[ip] = (int)failuser.Session[ip] + 1;
    else
        failuser.Session[ip] = 1;
 
    //
    retval = failuser.Session[ip].ToString();
    if ((int)failuser.Session[ip] > 2)
    {
 
        retval = "!";
 
    }
Posted 2-Sep-12 3:45am
Comments
behrad110 2-Sep-12 9:51am
   
Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,924
CHill60 3,550
Maciej Los 3,312
ppolymorphe 2,120
Jochen Arndt 1,973


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 2 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100