Question

I am using forms authentication. My users are redirected to a page (written in web.config) when they login, but some of them may not have the privilages to access this default page. In this case, I want them to redirect to another page but RedirectFromLoginPage method always redirects to the default page in web.config. How do I make the users login, and then redirect to a page which depends on some criteria?

Was it helpful?

Solution

The SetAuthCookie allows you to issue the auth cookie but retain control over the navigation. After that method is called you can run your logic to do a typical ASP.NET redirect to wherever you want.

OTHER TIPS

if(mc.GetfaalUsers(mm.UserName.ToString())=="True")
{
    this.Page.ClientScript.
       RegisterClientScriptBlock(this.GetType(), "key", 
                                 "alert('این نام کاربری فعال نشده است');", false);
    FormsAuthentication.SignOut();
    Response.Redirect("default.aspx");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top