Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>if you do not want to get into asp membership, here can be a simple solution: based on the Url where the request come from you can write this code in your Login.aspx.cs page:</p> <pre><code>protected void LoginButton_Click(object sender, EventArgs e) { //I detect where the request originated from string str = Request.QueryString["ReturnUrl"] == null ? "" : Request.QueryString["ReturnUrl"].ToString(); //if this is Admin can access to Admin Area only if (str.Contains("Admin") == true || str.Contains("admin") == true || str.Contains("ADMIN") == true) { string[] UserNameCollection = { "Admin" }; string[] PasswordCollection = { "admin" }; for (int Iterator = 0; Iterator &lt;= UserNameCollection.Length - 1; Iterator++) { bool UserNameIsValid = (string.Compare(UserName.Text, UserNameCollection[Iterator], true) == 0); bool PasswordIsValid = (string.Compare(Password.Text, PasswordCollection[Iterator], false) == 0); if (UserNameIsValid &amp;&amp; PasswordIsValid) { FormsAuthentication.SetAuthCookie(UserName.Text, true); Response.Redirect("Admin/Default.aspx"); } else { BadCredentials.Text = "Not valid"; BadCredentials.Visible = true; } } } //if this is a crm user can access to Crm Area only else if (str.Contains("Staff") == true) { string[] UserNameCollection = { "Staff" }; string[] PasswordCollection = { "staff" }; for (int Iterator = 0; Iterator &lt;= UserNameCollection.Length - 1; Iterator++) { bool UserNameIsValid = (string.Compare(UserName.Text, UserNameCollection[Iterator], true) == 0); bool PasswordIsValid = (string.Compare(Password.Text, PasswordCollection[Iterator], false) == 0); if (UserNameIsValid &amp;&amp; PasswordIsValid) { SaveVisitedEntry("CrmAdmin"); FormsAuthentication.SetAuthCookie(UserName.Text, true); Response.Redirect("Staff/Default.aspx"); } else { BadCredentials.Text = "Not valid"; BadCredentials.Visible = true; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload