Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with redirects or sessions

Problem with redirects or sessions

Scheduled Pinned Locked Moved ASP.NET
helpquestioncsharpasp-net
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hasanali00
    wrote on last edited by
    #1

    Hi I created my site in asp.net 1.1 It has been running for quite a while now. However, recently, I have started having problems with it. First, I was have a 'Unable to validate data' problem. I resolved this issue by adding the following to my web.config file: enableSessionState="true" enableViewState="true" enableViewStateMac="false" /> However, I am having another strange problem. I have a secure page (Web_page.aspx) and requires the user to be logged in to the site. I perform this check with the following code in web_page.aspx: if(!Context.User.Identity.IsAuthenticated) { Response.Redirect("login_page.aspx"); } else { continue with the page} The problem is that: If a person is logged in and he clicks on the web_page.aspx link, the system redirects them to login.aspx page (the system should take them to the web_page.aspx page because the user is already logged in). At this if the user clicks on web_page.aspx link AGAIN, then it works correctly, i.e. I am taken to web_page.aspx. As you can see, I have to click TWICE on this link to make it work correctly. This is happening with ALL the pages that require login. Very strange indeed. Any idea what is happening here? My system was working correctly in the past. This problem has just emerged.

    A 1 Reply Last reply
    0
    • H hasanali00

      Hi I created my site in asp.net 1.1 It has been running for quite a while now. However, recently, I have started having problems with it. First, I was have a 'Unable to validate data' problem. I resolved this issue by adding the following to my web.config file: enableSessionState="true" enableViewState="true" enableViewStateMac="false" /> However, I am having another strange problem. I have a secure page (Web_page.aspx) and requires the user to be logged in to the site. I perform this check with the following code in web_page.aspx: if(!Context.User.Identity.IsAuthenticated) { Response.Redirect("login_page.aspx"); } else { continue with the page} The problem is that: If a person is logged in and he clicks on the web_page.aspx link, the system redirects them to login.aspx page (the system should take them to the web_page.aspx page because the user is already logged in). At this if the user clicks on web_page.aspx link AGAIN, then it works correctly, i.e. I am taken to web_page.aspx. As you can see, I have to click TWICE on this link to make it work correctly. This is happening with ALL the pages that require login. Very strange indeed. Any idea what is happening here? My system was working correctly in the past. This problem has just emerged.

      A Offline
      A Offline
      Ashik Wani
      wrote on last edited by
      #2

      What kind of Authentication you are using. Are you using some custom one or soem built in ASP.NET like Froms etc? Cheers, Ashik

      H 1 Reply Last reply
      0
      • A Ashik Wani

        What kind of Authentication you are using. Are you using some custom one or soem built in ASP.NET like Froms etc? Cheers, Ashik

        H Offline
        H Offline
        hasanali00
        wrote on last edited by
        #3

        To me , it does not seem like a authentication or session expiration problem. The users are still logged in when they click on the link twice. It seems more like a caching problem on the client side

        A 1 Reply Last reply
        0
        • H hasanali00

          To me , it does not seem like a authentication or session expiration problem. The users are still logged in when they click on the link twice. It seems more like a caching problem on the client side

          A Offline
          A Offline
          Ashik Wani
          wrote on last edited by
          #4

          Have u first time checked the condition in the page load event when it redirects to login page? Does the IsAuthenticated come False ? Ashik

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups