473,566 Members | 3,004 Online
Bytes | Software Development & Data Engineering Community
+ 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 4684
Hi,

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

<location path="publicpag e.aspx">
<system.web>
<authorizatio n>
<allow users="*" />
</authorization>
</system.web>
</location>

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

"Adam J Knight" <ad**********@o ptusnet.com.au> wrote in message
news:OK******** ******@TK2MSFTN GP10.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" ?>
<configuratio n>
<appSettings>
<add key="ConnStr" value="Data Source=myDataSo urce;Initial
Catalog=myDb;Us er=myUser; Password=myPass word"/>
</appSettings>
<system.web>
<compilation defaultLanguage ="c#" debug="true"/>
<customErrors mode="RemoteOnl y"/>
<trace enabled="false" requestLimit="1 0" pageOutput="fal se"
traceMode="Sort ByTime" localOnly="true "/>
<sessionState mode="InProc"
stateConnection String="tcpip=1 27.0.0.1:42424" sqlConnectionSt ring="data
source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="fal se" timeout="20" />
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8"/>
</system.web>
<location path="Admin">
<system.web>
<authenticati on mode="Forms">
<forms loginUrl="Admin/Login.aspx"/>
</authentication>
<authorizatio n>
<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" ?>
<configuratio n>

<appSettings>
<add key="ConnStr" value="Data Source=myDataSo urce;Initial
Catalog=myDb;Us er=myUser; Password=myPass word"/>
</appSettings>

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

<compilation defaultLanguage ="c#" debug="true"/>
<customErrors mode="RemoteOnl y"/>
<trace enabled="false" requestLimit="1 0" pageOutput="fal se"
traceMode="Sort ByTime" localOnly="true "/>
<sessionState mode="InProc"
stateConnection String="tcpip=1 27.0.0.1:42424" sqlConnectionSt ring="data
source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="fal se" timeout="20" />
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8"/>
</system.web>

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

</configuration>

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

"Adam J Knight" <ad**********@o ptusnet.com.au> wrote in message
news:ew******** **********@TK2M SFTNGP15.phx.gb l...
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" ?>
<configuratio n>
<appSettings>
<add key="ConnStr" value="Data Source=myDataSo urce;Initial
Catalog=myDb;Us er=myUser; Password=myPass word"/>
</appSettings>
<system.web>
<compilation defaultLanguage ="c#" debug="true"/>
<customErrors mode="RemoteOnl y"/>
<trace enabled="false" requestLimit="1 0" pageOutput="fal se"
traceMode="Sort ByTime" localOnly="true "/>
<sessionState mode="InProc"
stateConnection String="tcpip=1 27.0.0.1:42424" sqlConnectionSt ring="data
source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="fal se" timeout="20" />
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8"/>
</system.web>
<location path="Admin">
<system.web>
<authenticati on mode="Forms">
<forms loginUrl="Admin/Login.aspx"/>
</authentication>
<authorizatio n>
<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
4014
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 load the data by something like that: LOAD FROM "/pathto/artikel.data" OF DEL MODIFIED BY DATESISO CHARDEL0xbf SAVECOUNT 50000 MESSAGES...
2
4423
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 without having to Log In. How do I change my web.config file to exclude certain files. <authentication mode = "Forms"> <forms name = ".ASPX"...
1
2263
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, how shall I do it? Thanks! -- WWW: http://hardywang.1accesshost.com
4
2645
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 user and some others, like the home page is not required. I specified the <deny users="?" /> on the web.config, but this is causing ALL pages require...
1
1230
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 files that directory in Release mode? Thanks. -Oleg.
2
13641
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
1661
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 mostly come at the start of the application. After a couple of such 'general' pages, the login screen comes. How do tackle this situation? Advance...
1
1798
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 page because of the obvious reasons. So is there anyway I can exclude certain files? To make them "public". I know if i create another VDir and...
0
374
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 (No Authentication Dialog). Could some body guide in achieving solution for this. Flow Steps 1. User visits the home page (One.asp page) No NT...
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7953
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
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.