请问关于ASP.net安全登录确认的使用?

Edwin6 2004-01-31 11:25:25
在一个例子中看到
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Request.IsAuthenticated Then
div3.Visible = True
div4.Visible = False
Unick.Text = Context.User.Identity.Name
Else
div3.Visible = False
div4.Visible = True
Unick.Text = "客人"
End If
sub end


请问哪里有关于象
Request.IsAuthenticated
Context.User.Identity.Name
等类与方法的系统使用方法,这可以和自已设计的数据库结合起来用吗?

...全文
50 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
xueqs 2004-01-31
  • 打赏
  • 举报
回复
没用过
alongman 2004-01-31
  • 打赏
  • 举报
回复
ASP方面的书
xnice 2004-01-31
  • 打赏
  • 举报
回复
查文档
delphi1998 2004-01-31
  • 打赏
  • 举报
回复
Request.IsAuthenticated
Context.User.Identity.Name
一个用户进入页面后,会产生一个当前会话对象,此对象有负责人属性,即Identity,然后可以对此进行判断,可以判断用户是否登录或是否为当前对象。
coollzh 2004-01-31
  • 打赏
  • 举报
回复
更多关于asp.net 安全性的问题,查看一下
System.Web.Security 命名空间
coollzh 2004-01-31
  • 打赏
  • 举报
回复
Request.IsAuthenticated is not just for forms authentciation - it is valid
no matter what type of authentication is being used (Windows, Passport,
Forms or our own custom scheme) 再web.config文件中设定认证方式

HttpRequest.IsAuthenticated will be true when the user making the request
has been authenticated. Essentially, this property provides the same
information as Context.User.Identity.IsAuthenticated.

At the start of a request, Context.User.Idenity contains a GenericIdentity
with a null username. The IsAuthenticated property for this object will
return false so Request.IsAuthenticated will be false. When an
authentication module handles the Application_AuthenticateRequest event and
successfuly authenticates the user it replaces the GenericIdentity in
Context.User.Identity with a new IIdentity object that will return true from
its IsAuthenticated property. Request.IsAuthenticated will then return true.

In the case of Forms authentication, the forms authentication module uses
the encrypted authentication ticket contained in the authentication cookie
to authenticate the user. Once it has done this, it replaces the
GenericIdentity in Context.User.Identity with a FormsIdentity object that
returns True from its IsAuthenticated property.

So, setting IsAuthenticated to true is actually different to logging in. As
Jeff says, logging in to forms authentication happens when the
authentication ticket is generated and sent to the client as a cookie.
(RedirectFromLoginPage or SetAuthCookie) What we are talking about with
IsAuthenticated is authentication that happens with each page request.
Logging in happens when a user enters their credentials and is issued a
ticket, authentication happens with each request.

I hope this explanation helps.

Dan.

(Currently working on Professional ASP.NET Security for Wrox)
elite2018 2004-01-31
  • 打赏
  • 举报
回复
www.phei.com
sinocat 2004-01-31
  • 打赏
  • 举报
回复
没用过
建议看msdn
zsww 2004-01-31
  • 打赏
  • 举报
回复
帮你顶一下

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧