Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Usage of Forms Authentication. (http://www.velocityreviews.com/forums/t112832-usage-of-forms-authentication.html)

=?Utf-8?B?QW5kcmV3?= 11-04-2005 03:51 AM

Usage of Forms Authentication.
 
Hi, friends,

When we set authentication in web.config file like the follows:

<authentication mode="Forms">
<forms loginUrl="login.aspx" name="myAppCookie" />
</authentication>

we really force a user to access login.aspx first, right?

However, in many cases, we really want to show default.aspx and some other
..aspx to visitors who are not our customers yet. We want them to look at our
web pages before they decide to create an account with us. (With above
setting, a user will have to create a new account before he/she can view any
other pages).

How can I implement this business requirment in asp.net app? Any reference
paper, sample source code?

Thanks a lot for your help.

=?Utf-8?B?YnJpYW5zW01DU0Rd?= 11-04-2005 05:04 AM

RE: Usage of Forms Authentication.
 
Hello Andrew -

There's probably a couple of different ways to do accomplish your goal but
the <location> and <authorization> elements in web.config are your friends.
One way would be to put a link on your login.aspx page to a mydemo directory.
That way when anyone connects to your website, they will be presented with
the login page but anyone could link to the demo directory. In the web.config
you would need to use the <location> element and allow everyone access:

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

Or you can use use the <location> element and to allow access to individual
pages in the default directory:

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

As you can imagine, there's plenty of variations. Check out the following
article for a pretty good overview on form authorization:

http://www.theserverside.net/article...Authentication

--
brians
http://www.limbertech.com


"Andrew" wrote:

> Hi, friends,
>
> When we set authentication in web.config file like the follows:
>
> <authentication mode="Forms">
> <forms loginUrl="login.aspx" name="myAppCookie" />
> </authentication>
>
> we really force a user to access login.aspx first, right?
>
> However, in many cases, we really want to show default.aspx and some other
> .aspx to visitors who are not our customers yet. We want them to look at our
> web pages before they decide to create an account with us. (With above
> setting, a user will have to create a new account before he/she can view any
> other pages).
>
> How can I implement this business requirment in asp.net app? Any reference
> paper, sample source code?
>
> Thanks a lot for your help.



All times are GMT. The time now is 01:30 PM.

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