Why it does not work when accessing from internet?

Discussion in 'ASP .Net' started by =?Utf-8?B?QW5kcmV3?=, Jan 11, 2006.

  1. Hello friends,

    I am building a website hosted through DSL box. It uses Form Authentication.
    When I tested from local network machine, it worked fine: Asking me to login
    if I
    tried non-public pages. After I typed in user name and password, it directed
    me to the page I wanted.

    However, if a person tried to access it through internet, e.g., a machine
    from
    client, it stays in Login.aspx page, even after correct user name and
    password were entered.

    Any ideas?Thanks a lot. (Someone said it could be IIS setting problem?)

    The following is the source code for authentication. Any code could be wrong?

    ---------------------------------------------------------------------

    if (this.IsPostBack)
    {
    myTools.SQL mSQL = new
    SQL(System.Configuration.ConfigurationSettings.AppSettings["sqlConnectionString"]);

    System.Data.DataSet mDataSet = mSQL.sqlExecLoginQuery("sp_Login",
    Request.Form["txtLoginName"]);

    if (mDataSet.Tables[0].Rows.Count == 0)
    Response.Redirect("NewUser.aspx"); //a new user
    else
    {
    if
    (FormsAuthentication.HashPasswordForStoringInConfigFile(Request.Form["txtPswd"], "MD5") != mDataSet.Tables[0].Rows[0]["pswd"].ToString())
    {
    this.loginInfo.Text = "Invalid password. Please try again.";
    }
    else
    {
    Session["userID"] = mDataSet.Tables[0].Rows[0]["userID"].ToString();
    Session["loginName"] =
    mDataSet.Tables[0].Rows[0]["loginName"].ToString();
    FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"], true);

    FormsAuthentication.RedirectFromLoginPage(Request.Form["txtLoginName"], true);
    }
    }
     
    =?Utf-8?B?QW5kcmV3?=, Jan 11, 2006
    #1
    1. Advertising

  2. Please post the link for us to test

    "Andrew" wrote:

    > Hello friends,
    >
    > I am building a website hosted through DSL box. It uses Form Authentication.
    > When I tested from local network machine, it worked fine: Asking me to login
    > if I
    > tried non-public pages. After I typed in user name and password, it directed
    > me to the page I wanted.
    >
    > However, if a person tried to access it through internet, e.g., a machine
    > from
    > client, it stays in Login.aspx page, even after correct user name and
    > password were entered.
    >
    > Any ideas?Thanks a lot. (Someone said it could be IIS setting problem?)
    >
    > The following is the source code for authentication. Any code could be wrong?
    >
    > ---------------------------------------------------------------------
    >
    > if (this.IsPostBack)
    > {
    > myTools.SQL mSQL = new
    > SQL(System.Configuration.ConfigurationSettings.AppSettings["sqlConnectionString"]);
    >
    > System.Data.DataSet mDataSet = mSQL.sqlExecLoginQuery("sp_Login",
    > Request.Form["txtLoginName"]);
    >
    > if (mDataSet.Tables[0].Rows.Count == 0)
    > Response.Redirect("NewUser.aspx"); //a new user
    > else
    > {
    > if
    > (FormsAuthentication.HashPasswordForStoringInConfigFile(Request.Form["txtPswd"], "MD5") != mDataSet.Tables[0].Rows[0]["pswd"].ToString())
    > {
    > this.loginInfo.Text = "Invalid password. Please try again.";
    > }
    > else
    > {
    > Session["userID"] = mDataSet.Tables[0].Rows[0]["userID"].ToString();
    > Session["loginName"] =
    > mDataSet.Tables[0].Rows[0]["loginName"].ToString();
    > FormsAuthentication.SetAuthCookie(Request.Form["txtLoginName"], true);
    >
    > FormsAuthentication.RedirectFromLoginPage(Request.Form["txtLoginName"], true);
    > }
    > }
    >
     
    =?Utf-8?B?QWxiZXJ0IFBhc2N1YWw=?=, Jan 11, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QW5kcmV3?=

    Why it does not work when accessing from internet?

    =?Utf-8?B?QW5kcmV3?=, Jan 10, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    374
    =?Utf-8?B?QW5kcmV3?=
    Jan 10, 2006
  2. Horace Nunley

    why why why does function not work

    Horace Nunley, Sep 27, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    500
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 27, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    978
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,221
    Smokey Grindel
    Dec 2, 2006
  5. Andrew
    Replies:
    0
    Views:
    133
    Andrew
    Jan 10, 2006
Loading...

Share This Page