Web.config <location> not redirecting

T

T-1000

I have a website with a /Admin subdir I want to protect via a
signin.aspx page (which is in the Admin dir.)

This is the entire contents of the web.config file located at the root
of the website:

<?xml version="1.0"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="CunePressDB" connectionString="Data
Source=66.235.176.128;Initial Catalog=CunePress;User
ID=dotstorefront;Password=storefront"
providerName="System.Data.SqlClient"/>
</connectionStrings>

<system.web>
<compilation debug="true"/>
<authentication mode="None"/>
</system.web>

<location path="~/Admin">
<system.web>
<authentication mode="Forms">
<forms name="CunePress" loginUrl="~/Admin/SignIn.aspx"
path="/Admin"/>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
</configuration>

What am I missing? Everything located between the <location> tags used
to work, when the Admin directory was a seperate application process
running in IIS. I am attempting to roll the client and Admin side into
a single application that can be developed using the .Net development
server on a developer's computer.
 
D

Dominick Baier [DevelopMentor]

just use

<location path="Admin">

also - i would not recommend using a cookie path - they are case sensitive,
so for e.g. if a user types in /admin - the browser will not send the cookie
and the user has to reauthenticate.
 
T

T-1000

if I do that I get:

"Error 25 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. C:\Documents and Settings\Administrator\My
Documents\Visual Studio 2005\WebSites\CunePress\Web.Config 15"
 
D

Dominick Baier [DevelopMentor]

you also need to set authentication mode to forms...

is you base dir marked as an application in IIS?
 
T

T-1000

it already is set to forms...

and I am not using IIS, I am running it with the .net Development
Server...

when you say base path, are you refering to Admin?

as I said, I am trying to run the admin and client side together using
the development server... having to install IIS on the development
machine is a PITA, and I am trying to avoid it. If I was running IIS
on my development machine, I could have a totally seperate web.config
in the Admin dir, with controls its authentication seperately.

Also, the Admin and Client sides have to access common files, such an
images directory. So, having them packaged together in the same
application space will make that much easier.
 
P

Patrick.O.Ige

You are getting that error because you haven't configured your deirectory
you can do that
in IIS by clicking on create
Patrick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top