0

Alright after working on a login page and completing it, the requirements for my project have changed. I am no longer using FormsAuthentication to see if someone is logged in. Instead I am putting a passcode as the query. If the passcode exists then I let them continue to the page. If it does not exist I need to redirect them to a page so that they can enter the passcode. But first I need to capture the returnurl. Everything I read says returnurl has to do with FormsAuthentication, so I cannot find out how to capture the returnurl. Any help please?

2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Jesi523
0

I think I figured out that you use Request.RawUrl, but now on my page load I am trying to redirect if passcode exists in the URl go ahead to the screen, if not go to the login screen. Here's my code and it just keeps looping.

protected void Page_Load(object sender, EventArgs e)
        {
            string eventAuid = Request.QueryString["eventAuid"];
            string passcode = Request.QueryString["passcode"];
            string returnUrl = Request.RawUrl;

            if (passcode != null)
                {
                    Response.Redirect("EditEventDetails.aspx?eventAuid=" + eventAuid + "&passcode=" + passcode);
                }
                else
                {
                    Response.Redirect("Login.aspx?returnUrl=" + returnUrl);
                }
            
        }

Help Please!!!!!

0

so wot's the problem bigguy..

while redirecting append the current page URL to after login.aspx

which is implemented in very good manner by Mr Jesi 525

but i'm kinda thinking it would be donkey work.

instead you can think of something like a page or some utility which handles all this stuff.

so you dont have to do this manually on every page..!

hope that would help !

Edited by dnanetwork: n/a

0

I was going in a continuous loop with this:

if (passcode != null)                {                    Response.Redirect("EditEventDetails.aspx?eventAuid=" + eventAuid + "&passcode=" + passcode);                }

So I removed that, and instead of trying to get the returnURL like this:

string returnUrl = Request.RawUrl;

I just hard coded the page with the URL and then add my querystring parameters at the login page before it was redirected back after the passcode was entered correctly. I only need to do it on two pages of my whole site, so it works for the two pages.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.