Link to home
Start Free TrialLog in
Avatar of viola123
viola123

asked on

Why does my webpage redirect to another page automatically after login?

Hi All,
i installed our website E on our server A. it works fine on that server. but when i tried to access it from my machine (note: not server A ), i had the following issues:
1. load the login page --> works fine
2. key in my credential and click LogIn button--> it automatically jumps to the default page of our public website O

what i expected is: after login, it should go to page C under website E.
Note: website E is the subwebsite of website O

in Login page:
protected void bLogin_Click(object sender, ImageClickEventArgs e)
    {
        if (!Page.IsValid)
            return;

        var user = WebUser.getByEmail(tbUsername.Text.Trim());
        if (user != null)
        {
            if (user.VerifyPassword(tbPassword.Text, true))
            {
                // store the user object so we can reference it on pages.
                Session["USER"] = user;

                // prevent multiple login by the same user (see Global.asax)
                Application["SessionID " + user.Id] = this.Session.SessionID;
               
//this is where the login page should go to. it goes to next page C when running on server A locally. but jumps to public website O when testing it on my machine                                 System.Web.Security.FormsAuthentication.RedirectFromLoginPage(user.Id.ToString(), false);
               
            }
        }
    }
******************************
web.config:

<authentication mode="Forms">
      <forms loginUrl="~/login.aspx" timeout="20" defaultUrl="~/Default.aspx" />
    </authentication>
    <authorization>
      <deny users="?" />
      <allow users="*" />
    </authorization>

**********************

Can anyone please point me to the right direction?

thanks heaps
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

The simple answer is that you are probably telling it to.  It will probably be in an absolute URL like "http://www.publicsite.com/" or in a 'basehref' line in your HTML.
Avatar of viola123
viola123

ASKER

Hi,
in login.aspx, when you click Logo, it will redirect to www.publicWebsiteO.com.
Could you give me more details?

thanks
regards
Hi,
Please note it works fine when testing on the Server A itself.

thanks
ASKER CERTIFIED SOLUTION
Avatar of viola123
viola123

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i solved it.