I am hosting my website in IIS 5.1. When i am accessing the site using localhost/xwy/Login.aspx after entering login credential i am able to move to next page (main.aspx) of the site. But , when I use xyz.com/xwy/login.aspx where (xyz.com is the machine name) and enter login credential , then i am redirected back to login.aspx.After, checking Trace.axd I found in page main.aspx Session variables are not instantited ie under Session State section no session variable is present.
I am using ASP.NET 4.0 for website. How to solve this problem?
The authentication is made base on the cookies, and the cookies are set base on the domain name
When you change from localhost/xwy/Login.aspx
to xyz.com/xwy/login.aspx
the domain name is change.
The reason that not work the same for both is because you probably have set the domain
parametre on web.config. Remove it to let the cookies apply to any domain.
The place that you set the host on the web.config are:
<authentication mode="Forms">
<forms domain="local.com" />
</authentication>
<httpCookies domain="local.com" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.