There is something that crossed my mind while trying to publish and view my test web application on a live server. After publishing the web application, I tried to view the application but I redirected me to the login page. But it was supposed to take me to the Default page.
Then I figured that I had done routing in the Global asax file to some pages that anonymous or every user can be able to view. Does this mean web forms authentication in the web config does not recognize routing in Global asax file?
Please I want help in learning how to resolve this. Thank you
<system.web>
<trust level="Full"/>
<sessionState timeout="40"></sessionState>
<authentication mode="Forms">
<forms name="login" timeout="40" cookieless="UseCookies" loginUrl="Login.aspx" defaultUrl="overview.aspx" slidingExpiration="true" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" maxRequestLength="3145728" />
<customErrors mode="Off" />
<pages enableEventValidation="false">
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
<location path="Signup.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="About.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Global.asax
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
ScriptManager.ScriptResourceMapping.AddDefinition("jquery",
new ScriptResourceDefinition
{
Path = "~/scripts/jquery-1.7.2.min.js",
DebugPath = "~/scripts/jquery-1.7.2.min.js",
CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js",
CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js"
});
RegisterRoutes(RouteTable.Routes);
}
static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("About", "about", "~/About.aspx");
routes.MapPageRoute("Login", "login", "~/Login.aspx");
routes.MapPageRoute("Signup", "signup", "~/Signup.aspx");
}