domain redirecting but domain/default.aspx works fine
When I go to http://www.domain.com/ or http://www.domain.com it redirects to the following:
http://www.domain.com/login.aspx?ReturnUrl=%2f
I can add new routes and they seem to work fine. It's just the base domain isn't loading properly. Any ideas?
My setup:
Microsoft Windows Server 2003 R2 Standard x64
MMC3 v5.2 R2
ASP.NET Version: 4.0.30319
site Properties > Documents > Default.aspx is first item listed
root files:
/default.aspx
/login.aspx
Global.asax
Code:
<%@ Application Language="VB" %>
<%@ Import Namespace="System.Web.Routing" %>
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
RegisterRoutes(RouteTable.Routes)
End Sub
Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.MapPageRoute("Home", _
String.Empty, _
"~/default.aspx")
End Sub
Web.config
Code:
<configuration>
<appSettings configSource="AppSettings.config" />
<connectionStrings configSource="ConnectionString.config"/>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
<httpRuntime requestPathInvalidCharacters=""/>
<authentication mode="Forms">
<forms name=".SiteAuth" loginUrl="~/login.aspx" timeout="5000" protection="Validation" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
<location path="default.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<system.net>
<mailSettings>
<smtp>
<network host="smtp.site.com" port="25" userName="" password="" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
</configuration>
Re: domain redirecting but domain/default.aspx works fine
My guess is that you are denying access to anonymous users from the entire site so you get dropped to the login page from the main page.
If you need anon user to access your main page,
use:
Code:
<authorization>
<allow users="*"/>
</authorization>
Then work your way out on any page that needs to be authenticated.