Forms authentication

  • Thread starter Thread starter Jenny
  • Start date Start date
J

Jenny

Hi all

How can the following problem be solved:

My application uses forms authentication. Normally a
start.aspx page should be send to the client before
login.aspx is shown.
Start.aspx consist of simple JScript writing a cookie about
screen resolution followed by an automatic transfer to
login.aspx. This page is therefore test whether cookies and
JScript are activated.

But if forms authentication is activated, the only
accessible page is login.aspx. So I need first to login and
therefore set the authentication cookie in order to access
start.aspx (checking whether cookie are activated.... :-) ).
My webconfig is:

<authentication mode="Forms" >
<forms
name="Auth-Cookie"
path="\"
loginUrl="Login.aspx"
protection="All"
timeout="25">
<credentials passwordFormat="Clear">
<user name="Test" password="Pass" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>

The deny setting prevent unathorized user from accessing
start.aspx. But this is necessary to make the cookie and
jscript check!

Each help appreciated!

Thanks
Jenny
 
Jenny,
You can overrride specific allow/deny permissions for individual pages and
directories.

What you have already defined in the <authorization> tag of <system.web>
will be applied to all pages that do not have any of their own setting
defined.
To override that setting for a specific page, in your case start.aspx, just
place the following code in your web.config file:
<configuration>
....
<system.web>
....
</system.web>

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

</configuration>

note that this is contained in the <configuation> tag, but after the ending
</system.web> tag.

that code will allow everyone, authenticated or not, to access start.aspx.

HTH,
-Cliff
 
Hi There...

I am getting this wierd error when i am adding location tags in my
web.config.

"System.exception: there is more than one system.web section in your
configuration file"

Does anyone know why its happening. I am using WSE 1.0 SP1, i have
tried reinstalling it, but no good yet.

Any assistance will be highly appreciated.
Thanx.

Reeya.
 
Back
Top