Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Security (http://www.velocityreviews.com/forums/f62-asp-net-security.html)
-   -   Web.config <location> not redirecting (http://www.velocityreviews.com/forums/t768457-web-config-location-not-redirecting.html)

T-1000 03-29-2006 09:01 PM

Web.config <location> not redirecting
 
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.


Dominick Baier [DevelopMentor] 03-29-2006 09:10 PM

Re: Web.config <location> not redirecting
 
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.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> 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.
>




T-1000 03-29-2006 10:29 PM

Re: Web.config <location> not redirecting
 
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"


Dominick Baier [DevelopMentor] 03-29-2006 10:37 PM

Re: Web.config <location> not redirecting
 
you also need to set authentication mode to forms...

is you base dir marked as an application in IIS?

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> 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.
>




T-1000 03-29-2006 10:51 PM

Re: Web.config <location> not redirecting
 
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.


Patrick.O.Ige 03-31-2006 10:04 AM

Re: Web.config <location> not redirecting
 
You are getting that error because you haven't configured your deirectory
you can do that
in IIS by clicking on create
Patrick

"T-1000" <t-1000@verizon.net> wrote in message
news:1143671393.736345.29860@v46g2000cwv.googlegro ups.com...
> 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"
>





All times are GMT. The time now is 08:35 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.