Login Control and ReturnUrl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • semomaniz
    Recognized Expert New Member
    • Oct 2007
    • 210

    #1

    Login Control and ReturnUrl

    Hello,

    I have a database interface that needs to have a login authentication set up. SO for this I have a login view inside which i have the login control and i have accomplished the authentication by using membership class and role. But what i am having issue is with the returnurl. What i am trying to do is if the session expires i want the user to be directed back to the page that the user was on after he logs in. I am sure returnurl is the solution but it doesnt work for me. I am sure i am doing some thing worng. I dont even get any form of query string being passed in. Here is the code that i have in Login.aspx.cs
    in the page load event.


    Code:
    protected void Page_Load(object sender, EventArgs e)
        {
           
            string url = Request.QueryString["ReturnUrl"];
            if (!String.IsNullOrEmpty(url))
            {
                Login mylogin = (Login) LoginView1.FindControl("Login1");
               mylogin.DestinationPageUrl = url;
            }
    
        }

    Do i have to do something else on each pages that will pass the returnurl query string or param.

    Please help.

    THanks
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Does Request.Query ever have anything in it? Try using Request.Parem[] instead?

    Comment

    • semomaniz
      Recognized Expert New Member
      • Oct 2007
      • 210

      #3
      Originally posted by Plater
      Why bother having a login section at all if you want them to go right back to the page they were on when the session times out?

      There is a header that gets passed when you click a link in the browser called like Referer or something, that would contain the URL of the page they came from.
      I editted the explanation while you replied to my problem. Please re-read and help.

      Thank you

      Comment

      • semomaniz
        Recognized Expert New Member
        • Oct 2007
        • 210

        #4
        Can any body help with this issue?

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Originally posted by semomaniz
          Can any body help with this issue?
          I edited my reply to match your edited question.

          Comment

          • semomaniz
            Recognized Expert New Member
            • Oct 2007
            • 210

            #6
            Originally posted by Plater
            I edited my reply to match your edited question.

            I did use request.params[] but doesnt work either

            Comment

            • semomaniz
              Recognized Expert New Member
              • Oct 2007
              • 210

              #7
              Login Control and Return Url

              I have a form based auntenticated web project. What i am trying to do is if a user's session expires it directs the user to login page after he logs back in I want the user to be redirected to the page that the user was trying to access.

              I have used membership class for authentication purpose. on each page at the page_load event i perform a check if the user is authenticated if not it directs the page to login.aspx.

              Please refer to the posting


              Please help.

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                This has some explanation about return url (you will probably need to skip to the ending section)



                Also, I merged the threads. While I apologize for not being able to be more helpful, double posting is still against the guidelines.

                MODERATOR

                Comment

                • semomaniz
                  Recognized Expert New Member
                  • Oct 2007
                  • 210

                  #9
                  sorry didnt really know the guide line of dual posting. But this is where i stand i did get the part of the problem solved but now what i am having issue is that i have multiple queries passing in the returnurl. when i see the path in the IE explorer when the user is sent to login page i can see the multiple querystrings present along with the url of the page. But when i get authenticated only the first querystring is sent to the page and rest of the qureystring that are being sent in are being stripped off. dont know how exactly this is happening. Do you have any idea why this is happening.

                  I resolved my problem by using only one query string which has multiple information seperated by a comma. Then i using String.Split to seperate the information. This works for me but i am still curious why rest of the query string were dumped after authentication.


                  Thank you for you help.

                  Comment

                  • Plater
                    Recognized Expert Expert
                    • Apr 2007
                    • 7872

                    #10
                    Well what I am wondering is, the authentication schemes that ASP.NET uses, provide the functionality you desire built in (you need to do a smidge of configuration in web.config) but I believe it is part of the login scheme stuff.
                    That's why I posted that video, I was thinking it detailed (albeit near the end) how to setup the redirection stuff to go back to the page after logging back in.

                    Those ASP.NET "how do i" series of videos are pretty good.

                    Comment

                    • semomaniz
                      Recognized Expert New Member
                      • Oct 2007
                      • 210

                      #11
                      Thanks,

                      I will research on this issue later . using delimiter will work for what i want right now but only issue would be documenting it properly what is being passed-in ,in what order and so forth.

                      Thank you Plater

                      Comment

                      Working...