You must Sign In to post a response.
  • Category: ASP.NET

    Session TimeOut (urgent)

    Hi all,

    Following code has been used to validate user and role in master page page load event.

    if (Session["user"] != null)
    {
    string userRole = Session["user"].ToString();
    if (Roles.IsUserInRole(userRole, "r_loancleark") != true)
    {
    if (Roles.IsUserInRole(userRole, "r_loanmanager") != true)
    {
    Response.Redirect("~/Default.aspx");
    }

    }
    }
    else
    {
    Response.Redirect("~/Default.aspx");
    }

    This code running perfectly in development environment but not in deployment server.
    The issue is if after wait for sometime page is redirect to default page.

    Any suggestion highly appreciate.

    Thanks
    Chaminda
  • #767757
    hi

    set your session timeout period set your webconfig file.

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #767758
    Hai Chaminda,
    Looks like there is some configuration related issue with the IIS in your server machine. You need to check the IIS authentication configuration settings and set the roles for the role types for r_loancleark and r_loanmanager similar to the local system and then reset the IIS, hopefully it should work fine.
    For more references, you can go through the below link for some more techniques like changes in config file:

    https://forums.iis.net/t/1207245.aspx

    Looks like there is nothing to do with Session here.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #767762
    have you replaced your session timeout tag in web.config from local machine to server, secondly have you placed META tag in your ASPX ? if you have META tag in aspx then remove it and then check if it still redirect to default page
    Additionally please post the way you have implemented session handling in your code

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #767788
    Please check the <sessionState> tag has timeout attribute set or not.

  • #767800
    Hi,

    As i seen code their might be 2 reasons one is might be your session is expired, in that case increase the time limit in your production and second reason is check it below line of code "if (Roles.IsUserInRole(userRole, "r_loanmanager") != true)" whether userRole is loanmanager or not? may be this case might fail that is the reason it is redirect to the default page.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


  • Sign In to post your comments