Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET C#4.0 jQuery
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 at 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
0 _Amy 310
1 OriginalGriff 294
2 Nirav Prabtani 268
3 Sergey Alexandrovich Kryukov 211
4 CHill60 150
0 OriginalGriff 7,889
1 Sergey Alexandrovich Kryukov 7,006
2 Maciej Los 4,014
3 Peter Leow 3,708
4 CHill60 2,762


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 2 Sep 2012
Copyright © CodeProject, 1999-2014
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