跨页面保留用户登录凭据 [英] Persisting user login credentials across pages

查看:104
本文介绍了跨页面保留用户登录凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在Web应用程序的页面上存储用户数据库凭据的建议方式是什么?每次访问数据库时都是如此

系统不必再问他们用户名和密码

我们之前已将这些存储在会话变量(加密)和
$ b中从他们那里收回$ b - 但是如果

用户数增加,他们担心对性能的影响。

想过cookie但担心安全性(即使细节是

加密)显然用户能够删除等等。

提前谢谢

siobhan

解决方案

使用会话对象


成功登录后:


< SCRIPT runat =" SERVER">


Sub Login_Click(obj as Object,e as EventArgs)

IF tbName.Value<> "

会话(" Name")= tbName.Value

Response.Write(" Welcome"& Session(" Name")& "!")

ELSE

Response.Write(你没有登录!)

END IF

结束分


< / SCRIPT>


或者即使这样:


Sub Login_Click(obj as Object,e as EventArgs)


IF Request(" tbPassword")=" XXXX"那么

会话(LoggedIn)= TRUE

会话(" UserName")= Request.Form(" tbUserName")

Server.Transfer(" Session.aspx")

END IF


END Sub


blockquote>

如果有大量用户会怎么样 - 这会影响性能,或者

这是一个足够小的信息可以逃脱吗?

谢谢

" Sparky Arbuckle"写道:

或者即使这样:

Sub Login_Click(obj as Object,e as EventArgs)

IF Request(") tbPassword")=" XXXX"然后会话(LoggedIn)= TRUE
会话(UserName)= Request.Form(" tbUserName")
Server.Transfer(" Session.aspx")
END IF

END Sub



Hi
What is the recommended way to store a user''s database credentials across
the pages of a web application so that each time the database is accessed the
system doesn''t have to ask them for their username and password again
We have previously stored these in a session variable (encrypted) and
retrieved from their - but are worried about the impact on performance if the
number of users increases.
Had thought about cookies but worried about security (even if details are
encrypted) and obviously ability of user to be able to delete etc.
Thanks in advance
siobhan

解决方案

Using the Sessions Object

Once they login successfully:

<SCRIPT runat="SERVER">

Sub Login_Click(obj as Object, e as EventArgs)
IF tbName.Value <> ""
Session("Name") = tbName.Value
Response.Write("Welcome" & Session("Name") & "!")
ELSE
Response.Write("You Did Not Log In!")
END IF
END Sub

</SCRIPT>


OR EVEN THIS:

Sub Login_Click(obj as Object, e as EventArgs)

IF Request("tbPassword") = "XXXX" THEN
Session("LoggedIn") = TRUE
Session("UserName") = Request.Form("tbUserName")
Server.Transfer("Session.aspx")
END IF

END Sub


What if there is a large number of users - will this affect performance, or
is this a small enough amoun tof information to get away with?
Thanks
"Sparky Arbuckle" wrote:

OR EVEN THIS:

Sub Login_Click(obj as Object, e as EventArgs)

IF Request("tbPassword") = "XXXX" THEN
Session("LoggedIn") = TRUE
Session("UserName") = Request.Form("tbUserName")
Server.Transfer("Session.aspx")
END IF

END Sub



这篇关于跨页面保留用户登录凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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