We have a problem in our production environment, which doesn't occur in our
test-environment.
We have created two ASP.NET application with a common authorization.
Web-site-company
Login.aspx
<application1>
default.aspx
applicationpage.aspx
<application2>
default.aspx
anotherapplicationpage.aspx
what happens is this.
We send our customers to the site /Web-site-company/application1
IIS redirect the users to /Web-site-company/application1/default.aspx, but
they are not authorized yet,
so they are redirected to Login.aspx. After a succesfull login they are
redirected back to /Web-site-company/application1/default.aspx,
but they still are not authorized, and going back to the login.
But if the customer uses /Web-site-company/application1/applicationpage.aspx
they are authorized and can continue working.
Code from the pages:
/Web-site-company
----- Web.config
<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="10"
name="Companyname"
path="/Web-site-company"
slidingExpiration="true" />
</authentication>
<authorization>
<deny users="?" /> <!-- Allow all users -->
</authorization>
-----
----- Login.aspx
HttpCookie cookie = FormsAuthentication.GetAuthCookie( UserField.Text,
false );
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(
cookie.Value );
FormsAuthenticationTicket newticket = new FormsAuthenticationTicket(
ticket.Version,
ticket.Name,
ticket.IssueDate,
ticket.Expiration,
ticket.IsPersistent,
"Userdata",
ticket.CookiePath);
cookie.Value = FormsAuthentication.Encrypt(newticket);
Context.Response.Cookies.Set(cookie);
Response.Redirect( FormsAuthentication.GetRedirectUrl( newticket.Name,
newticket.IsPersistent ) );
-----
/Web-site-company/application1
----- Web.config
<authentication mode="Forms">
<forms loginUrl="/Web-site-company/Login.aspx"
protection="All"
timeout="10"
name="Companyname"
path="/Web-site-company"
slidingExpiration="true" />
</authentication>
<authorization>
<deny users="?" /> <!-- Deny all users -->
</authorization>
-----
----- Default.aspx
private void Page_Load(object sender, System.EventArgs e)
{
Response.Redirect("applicationpage.aspx", false);
}
-----
Production environment:
<Internet>-----<Firewall>-----<DMZ with web-site-company
server>----<Firewall>-----<company network>
Test-environment:
Test-PC and Webserver on the same network.
We used the same MSI-file to install the /Web-site-company and the
applications on the test- and production-environment.