Click here to Skip to main content
11,927,711 members (44,974 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked

about authentication mode in

, 7 Jun 2006
Rate this:
Please Sign up or sign in to vote.
When you begin a programe,you can consider authentication that's value either 'windows' or 'forms'


When you begin a program for a customer using ,you should consider about security.In web.config file you can set authentication mode value 'windows' or 'forms'.What's about difference and how you use then?(Authentication have other value.this artical not consider them.)

How to use mode windows

When you select this mode ,you can make all client access your project.Code like this(this case you can't get value using 'User.Identity.Name'):

<authentication mode="Windows" />

<allow users="*" />


other You can make make a special client to access you project with windows authentication.Code like this(this case you can get value using 'Use.Identity.Name',then you can use it to do other work you like.):

<deny users="?" />


How to use mode Forms

If you select 'Forms' mode.First you should specify a page and make sure all client can found it.Code like this:

<authentication mode="Forms">
<forms name="Authentication" loginUrl="LoginForForms.aspx" />

<location path="LoginForForms.aspx">
<allow users="*" />

Second in that page you to validate the use's Id and Password.Code like this:

FormsAuthentication.RedirectFromLoginPage("2", false);
catch (Exception ex)


This knowlege is simple for everybody.But i know this It's two years from i using C# and i write this article ,because i sure have many programer do know so many about it.This article must have lots of mistakes that I don't wake up to.So I welcome you tell me.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
China China
MY speciality is study at computer_soft develope and design. But after graduate form school,I work at a consultation company about one year.From that ,i lose work about half year.Then a work at soft company beacause one of my schoolfellow introduce.By far I study computer knowledge become more love it.
I like c\c++ and c# language. and like involved method,struct ect.
Other I have a good family :father,mother,sister,brother,and a pretty
girl friend. I live in china Tianjin.

You may also be interested in...

Comments and Discussions

GeneralVery practical Pin
_Nic_8-Oct-09 2:51
member_Nic_8-Oct-09 2:51 
GeneralGood article, but.... Pin
RichardGrimmer8-Jun-06 6:24
memberRichardGrimmer8-Jun-06 6:24 
GeneralRe: Good article, but.... Pin
Chandrashekhar Kulkarni7-Mar-07 5:18
memberChandrashekhar Kulkarni7-Mar-07 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 7 Jun 2006
Article Copyright 2006 by softprogramer
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid