用户名和密码限制aspx中的页面 [英] limit pages in aspx by username and password

查看:111
本文介绍了用户名和密码限制aspx中的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在我的网站上有会员,可以看到每一页,但是我将一些页面限制在不是我的会员的访客。

我该怎么办?

hi everybody I have member in my site , who can see every page, but I wana limit some of my pages to visitors who are not my member.
what should I do ?

推荐答案

在您的应用程序中使用表单身份验证请按照此链接



http://www.asp.net/web-forms/tutorials/security/introduction/an-overview -of-forms-authentication-cs [ ^ ]
Use Form authentication in your application follow this link

http://www.asp.net/web-forms/tutorials/security/introduction/an-overview-of-forms-authentication-cs[^]


Hello

您可以通过两种方法限制匿名用户



1)使用会话



在这种方法中你必须保留UserId in会话并且必须检查PageLoad或

PageInit事件页面上的会话变量。如果UserId是您可以继续使用,否则您可以将用户重定向到主页。



2)使用表单身份验证



您必须在web.config文件中设置身份验证和授权。



一般情况下最好使用表单身份验证会话,但如果有少量页面,那么你可以使用会话变量来限制匿名用户。
Hello
You can restrict anonymous user by two methods

1)By Using Session

In this method you have to mantain the UserId in session and have to check the session variable on PageLoad or
PageInit event of the page.If the UserId is your you can carry on , else you can redirect the user to the Main Page.

2)By Using Form authentication

You have to set authentication and authorization in web.config file.

generally It is better to use Form authentication instead of Session but if there are small number of pages then you can
restrict anonymous user by using Session variable.


这篇关于用户名和密码限制aspx中的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆