views:

21

answers:

1

Hi all

In asp.net we specify the redirect url when using forms authentications like this:

<authentication mode="Forms">
            <forms name="myApp" loginUrl="Login.aspx" protection="All" defaultUrl="default.aspx" path="/" requireSSL="false"/>
        </authentication>

this means that when a user log in, will be redirected to "default.aspx" using this method

FormsAuthentication.RedirectFromLoginPage(IDTextBox.Text, RememberCheckBox.Checked);

Now is it possible to make the user choose which page to be redirected to prior to login ?

for example the user chooses from a list the page to login to prior to login then when authenticated be redirected to this page instead of the default.aspx page.

is that possible and if so how can this be done ?

A: 

Instead of using the RedirectFromLoginPage method you could use the SetAuthCookie method and then redirect manually:

FormsAuthentication.SetAuthCookie(IDTextBox.Text, RememberCheckBox.Checked);
Response.Redirect("some url the user has choosen");
Darin Dimitrov