Here's a solution for when the user needs to log in before accessing a secure page. This allows the user to avoid going through the menu system to go to the original page desired. I avoid some kind of error by using the false parameter in the redirect. The querystring of note is ReturnUrl.
protected void Page_Load(object sender, EventArgs e)
{
if (User.Identity.IsAuthenticated == false)
{
Response.Redirect("Login.aspx?ReturnUrl=DesiredPage.aspx", false);
}
else
{
MembershipUser user = Membership.GetUser().ProviderUserKey.ToString();
}
}
RedirectFromLoginPage Method
No comments:
Post a Comment