Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set up multiple Forms Security Login Pages

Status
Not open for further replies.

romh

Programmer
Joined
Jan 3, 2003
Messages
297
Location
US
Okay,
I have a website. I can configure the whole site to be protected with forms security. My problem is that I want a sub directory of that site, to be protected but I would like another login .aspx file to show up instead of the parent one.
First of all, I was getting this error when I try to access the subdirectory:
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

I went to IIS and configured the subdirectoy as a virtual directory (application) and that still doesn;t work.

my web.config file looks like this in the subdirectory:

<configuration>
<system.web>
<authentication mode="Forms">
<forms name="Rom" loginUrl="Intralogin.aspx"
path="/"></forms>
</authentication>

<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>

Any help?
 
Let's say that your application is "TestApp" and it's located at " The security settings for FormsAuthentication should be something like this:
Code:
<configuration>
 <system.web>
  <authentication mode="Forms">
   <forms loginUrl="login.aspx" name=".AUTHCOOKIE"/>
  </authentication> 
  <authorization>
   <deny users="?"/>
  </authorization>
 </system.web>
</configuration>
where login.aspx is located uder the root of your webapplication. Now, let's say that you have a folder named "Special" under the root of your application that you want to apply a different login page on it. The global settings for the webapplication should now be:
Code:
<configuration>
 <location path="/">
  <system.web>
   <authentication mode="Forms">
    <forms loginUrl="login.aspx" name=".AUTHCOOKIE"/>
   </authentication> 
   <authorization>
    <deny users="?"/>
   </authorization>
  </system.web>
 </location>
 <location path="Special">
  <system.web>
   <authentication mode="Forms">
    <forms loginUrl="Special/login.aspx" name=".AUTHCOOKIE2"/>
   </authentication> 
   <authorization>
    <deny users="?"/>
   </authorization>
  </system.web>
 </location>
</configuration>
And, by the way, you do not have to configure the "Special" folder as a Virtual Directory, because, this way, you'll have to have a web.config file inside the "Special" folder.

[morning]
 
Thankls alot for your help but I couldn;t get it to work. It tells me that I can't have 2 of the same tags in the web.config file. Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top