数据以另一种形式 [英] DATA to ANOTHER FORM

查看:83
本文介绍了数据以另一种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在这里遇到问题..我希望将登录页面的文本发布在主页上.
示例:
用户名位于主页上.

代码是什么?

我在登录页面中的代码:

Hello guys, ive got a problem here.. i want the text of the login page be post at the home page.
Example:
the username be on the home page..

what is the code plss.

my code in login page:

If strUserURL <> "" Then
    lblInvalid.Text = ""
    FormsAuthentication.SetAuthCookie(txtUsername.Text, True)
    Response.Redirect("bob.aspx")



我可以使用Cookie获取用户名吗?

感谢和更多的力量



can i get the username using cookie??

thanks and more power

推荐答案

在您设置SetAuthCookie并从"bob.aspx"访问它后,将用户名分配给Session对象.
验证后:
Assign the username to a Session object once you SetAuthCookie and access it from the "bob.aspx"

After Authentication:
Session("Username") = txtUsername.Text



在"bob.aspx"中:



In "bob.aspx":

Dim username As String = Session("Username")




如果有帮助则将其标记为答案




Mark it as answer if it is helpful


会话变量(服务器端状态管理)比cookie(客户端状态管理)更安全.
我们可以禁用Cookie,对其进行破解或对其进行解码.
最好使用Session变量.

通过以下链接进行状态管理
StateManagement_Suggestions [
Session variable(Server side State Management) is more secure than cookies (client side State Management).
we can disable cookies, hack it or decode it.
Better to use Session variable.

Go through following link for State Management
StateManagement_Suggestions[^]


Fixed typos and TXT words[/Edit]


为什么不使用会话变量?我个人认为,用户名是敏感数据,除非您清除它们的机制运行良好,否则切勿将其存储在浏览器中.使用会话变量更安全.
Why not use Session Variables? I personally believe that username is a sensitive data that must not be stored on the browser, unless your mechanism of clearing them is working well. Using session variables is much safer.


这篇关于数据以另一种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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