Login throw IP (binding on IP)

  1. #1

    Login throw IP (binding on IP)

    Where i can find a good example of how to tie up login IP. I have default login form with two radio options for login: using cookie and using IP. Please send me where to find more information for this topic.

    P.S.: I'm newbie for this project, but I wanna understand first how do this.

    protected void btnLogin_Click(object sender, DirectEventArgs e) {
    string userName = txtUsername.Text;
    string password = txtPassword.Text;
    //bool saveMe = chkSaveMe.Checked;
    bool saveMe = radioCookie.Checked;
    var user = Helper.AuthUser(userName, password);
    if (user != null) {
    Session["user"] = user;
    if (!radioCookie.Checked && !radioIP.Checked) { //must be false
    FormsAuthentication.SetAuthCookie(user.Id.ToString (CultureInfo.InvariantCulture), saveMe);
    FormsAuthentication.RedirectFromLoginPage(user.Id. ToString(CultureInfo.InvariantCulture), saveMe);
    Response.Redirect(Request.QueryString["ReturnUrl"] + "" == ""
    ? FormsAuthentication.DefaultUrl
    : Request.QueryString["ReturnUrl"]);
    }
    if (radioCookie.Checked) { //must be true
    FormsAuthentication.SetAuthCookie(user.Id.ToString (CultureInfo.InvariantCulture), saveMe);
    FormsAuthentication.RedirectFromLoginPage(user.Id. ToString(CultureInfo.InvariantCulture), saveMe);
    Response.Redirect(Request.QueryString["ReturnUrl"] + "" == ""
    ? FormsAuthentication.DefaultUrl
    : Request.QueryString["ReturnUrl"]);

    }
    if (radioIP.Checked) { //must be true
    /*
    * Save IP to DB
    *
    */
    }

    } else {
    lblCheckError.Show();
    X.AddScript("App.WindowLogin.el.unmask();");
    }
    }
  2. #2
    Hello!

    Welcome to our forum.

    Please, use wrap your code in CODE tag. Read paragraph 3 here: http://forums.ext.net/showthread.php?10205

Similar Threads

  1. Replies: 0
    Last Post: Feb 23, 2012, 6:18 AM
  2. Replies: 2
    Last Post: Jun 24, 2011, 5:33 PM
  3. [CLOSED] Ext Throw format error when using Portuguese
    By sharif in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 02, 2010, 4:52 PM
  4. login problem with Ext Login Control
    By Bruce2010 in forum 1.x Help
    Replies: 1
    Last Post: Nov 30, 2010, 4:35 PM
  5. [CLOSED] ScriptManager throw exception in my masterpage
    By pumpkin in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 04, 2009, 3:09 AM

Tags for this Thread

Posting Permissions