473,473 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Exclude pages from authentication!

Hi all,

I have an app that mostly requires authentication.

However there are a couple of pages that don't require authentication..

What do i need in my web.config, to specify these pages don't require
authentication..
thus the user is not redirected to my default login url..when they ('pages')
are requested.

Cheers,
Adam
Feb 12 '06 #1
3 4668
Hi,

you can do that with <location> (path can either be single page or a
directory). Note that <location> element is placed right under
<configuration> element, not under the default <system.web> in standard
web.config

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

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Adam J Knight" <ad**********@optusnet.com.au> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I have an app that mostly requires authentication.

However there are a couple of pages that don't require authentication..

What do i need in my web.config, to specify these pages don't require
authentication..
thus the user is not redirected to my default login url..when they
('pages') are requested.

Cheers,
Adam

Feb 12 '06 #2
Hi,

I am not to clued up when it comes to Web.config.

Here is a butchered version, probably totally wrong..that attempts to
acheive what i am after.

Obviously it is incorrect, and producing an error..Would appreciated the
correct syntax!!!!

This is an attempt to apply authentication to a 'Admin' subject directory,
but have no security on pages in root directory...

Cheers,
Adam

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnStr" value="Data Source=myDataSource;Initial
Catalog=myDb;User=myUser; Password=myPassword"/>
</appSettings>
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<customErrors mode="RemoteOnly"/>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true"/>
<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
</system.web>
<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms loginUrl="Admin/Login.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>
Feb 12 '06 #3
You need to specify <authentication> etc on the root level, therefore you
need to do it kind of twisted

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<appSettings>
<add key="ConnStr" value="Data Source=myDataSource;Initial
Catalog=myDb;User=myUser; Password=myPassword"/>
</appSettings>

<system.web>
<!-- Authentication element on root level, just specify with
authorization that root level is public -->
<authentication mode="Forms">
<forms loginUrl="Admin/Login.aspx"/>
</authentication>
<authorization>
<allow users="*" />
</authorization>

<compilation defaultLanguage="c#" debug="true"/>
<customErrors mode="RemoteOnly"/>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true"/>
<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
</system.web>

<!-- Deny Access to Admin folder -->
<location path="Admin">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>

</configuration>

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Adam J Knight" <ad**********@optusnet.com.au> wrote in message
news:ew******************@TK2MSFTNGP15.phx.gbl...
Hi,

I am not to clued up when it comes to Web.config.

Here is a butchered version, probably totally wrong..that attempts to
acheive what i am after.

Obviously it is incorrect, and producing an error..Would appreciated the
correct syntax!!!!

This is an attempt to apply authentication to a 'Admin' subject directory,
but have no security on pages in root directory...

Cheers,
Adam

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnStr" value="Data Source=myDataSource;Initial
Catalog=myDb;User=myUser; Password=myPassword"/>
</appSettings>
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<customErrors mode="RemoteOnly"/>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true"/>
<sessionState mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
</system.web>
<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms loginUrl="Admin/Login.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>

Feb 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Olaf Gschweng | last post by:
We're new into DB2 and have some problem with DB2 8.1 (?) on a Linux system. We load some big tables of a DB2 database from files every day. We do a "DELETE FROM table" for each table and then we...
2
by: Peter | last post by:
I have a site which uses forms authentication but I would like to exclude certain pages on the site from authentication. In other words I would like the user to be able to get to these pages...
1
by: Hardy Wang | last post by:
Hi, I have a ASP.NET web site with form authentication. Now I need to create a sub folder named "abc", I need to exclude all files under this folder nopt to be protected by form authentication,...
4
by: MR. UNDERHILL | last post by:
I want to use forms authentication on my website. Looking at the documentation, I create a sample site for testing. One of my requirements is to ensure that SOME pages required an authenticated...
1
by: Oleg Ogurok | last post by:
Hi all, In my web project, I have directory with testing pages that I use for debugging. I would like to exclude it from the final product. Is there a way to tell VS.NET not to compile class...
2
by: Islam Elkhayat | last post by:
How can i exclude some files from the Form Authentication.. my welcome page and even custom error pages (404) is not working before authenticate. need help
5
by: Samba | last post by:
Hi, I've a web application and I'm using Forms authentication. My app contains some pages that can be viewed by everyone and it doesn't require any authentication or authoization and these pages...
1
by: DOTNETGUY | last post by:
How can I exclude a web form from Forms Autentication, For example lets say I need to redirect to a web form if the ip address of the client is not in my list. I cannot redirect to my error display...
0
by: venky | last post by:
Hi ASP'ians I have a requirement where I need to have windows authentication enabled for only few ASP pages of my Site (Virtual Directory), rest of the pages should be enabled for anonymous access...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.