Click here to Skip to main content
15,887,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have authentication in the web.config

XML
<location path="Default.aspx">
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</location>


XML
<authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880">
        <credentials passwordFormat="Clear">
          <user name="it" password="krypassword" />
        </credentials>
      </forms>
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>



everything works fine when running on local computer

but after publishing the webform my default.aspx must the first to load when visiting the site. but it just starts in the log in page

note: the default.aspx can be visit by all the visitors
and the users must log in for rest of the pages.

i do have the code for default document in the web.config

XML
<system.webServer>
  <defaultDocument enabled="true">
    <files>
      <clear />
      <add value="Default.aspx"/>
    </files>
  </defaultDocument>
</system.webServer>




i already did this one from the other forum
http://stackoverflow.com/questions/3824951/forms-authentication-ignoring-default-document[^]

1: adding this code in web.config
XML
<system.webServer>
  <handlers>
    <remove name="ExtensionlessUrl-Integrated-4.0"/>
    <remove name=" ExtensionlessUrl-ISAPI-4.0_32bit "/>
  </handlers>
</system.webServer>


2. or this one in the login.aspx
C#
protected void Page_Load(object sender, EventArgs e)
{
    if (!(IsPostBack || IsAsync))
    {
        string returnUrl = Request.QueryString["ReturnUrl"];
        if (returnUrl != null)
            if (returnUrl == "/")
                Response.Redirect("default.aspx");
    }
}


but not of them works
Posted
Updated 3-Aug-15 1:27am
v2
Comments
Afzaal Ahmad Zeeshan 3-Aug-15 7:59am    
Aren't you missing an else block in the code-behind?
Roshan 11862764 3-Aug-15 14:56pm    
Did you try setting Default document from IIS Whizard.
IIS-->Sites-->Your Website-->Default Document
jaylisto 3-Aug-15 21:57pm    
on default document in the iis/sites/mywebsite it has my default.aspx entry type: local
jaylisto 16-Aug-15 11:18am    
8/16/2015 STILL NO ANSWER :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900