Jef Lacanienta
Jef Lacanienta

Reputation: 3

Making Log In as default page on Visual Studio 2010

I wanted to make my login as the default page before the user accesses the home page. This is my code.

<system.webServer>
    <defaultDocument>
        <files>
           <clear/>
           <add value="Login.aspx"/>
        </files>
    </defaultDocument>
</system.webServer>

Thanks! :)

Upvotes: 0

Views: 203

Answers (2)

Huske
Huske

Reputation: 9296

What you need to do is first establish the authorization and authentication mechanism. You can use FormsAuthentication and configure the settings in a web.config file. For example, to enable forms authentication you would set the following value in the config file:

<authentication mode="Forms">
   <forms 
      name=".ASPXAUTH" 
      loginUrl="login.aspx" 
      defaultUrl="default.aspx" 
      protection="All" 
      timeout="30" 
      path="/" 
      requireSSL="false" 
      slidingExpiration="true" 
      cookieless="UseDeviceProfile" domain="" 
      enableCrossAppRedirects="false">
      <credentials passwordFormat="SHA1" />
   </forms>
   <passport redirectUrl="internal" />
</authentication>

Here you can see that loginUrl is set to login.aspx. This way, if a user is not authenticated, he or she will be redirected to login.aspx

This is much better approach than establishing your own logic for redirection to login or setting login.aspx as a start page.

Upvotes: 1

Jitendra Pancholi
Jitendra Pancholi

Reputation: 7562

just Right click on that page and click on set as start up page.

Upvotes: 2

Related Questions