开发者

What code can I use for authentication of users through login control?

Where should I type the authentication code in order to validate the users trying to login to the website.

I have used login control in my website. Also I would appreciate few examples of codes which are generally used in authentication co开发者_运维技巧de.


.net has templates for login pages, password recovery, etc.

simply google for it or go here:

http://msdn.microsoft.com/en-us/library/ms178329.aspx

http://www.c-sharpcorner.com/UploadFile/sushmita_kumari/Logincontrol101312006002845AM/Logincontrol1.aspx?ArticleID=c33d0072-8f7c-4958-a7dc-ca1809737193


Not 100% what you mean. If you're using a Login control they can already authenticate with that.

Do you mean authorization? You need to check users are authorized to access your site if it is restricted to logged in users only. Say you have a part of your site called "importantstuff" that only logged in users can access. i.e. www.yoursite.com/importantstuff/. You would put this in your web.config outside of the <system.web></system.web> tags:

  <location path="importantstuff">
<system.web>
  <authorization>
    <deny users="?" />
    <allow users="*" />
  </authorization>
</system.web>

This would prevent unauthenticated users from accessing anything in the "importantstuff" directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜