在登陆页面上获取用户名? [英] Fetch Username on landing Page ?

查看:96
本文介绍了在登陆页面上获取用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用formsauthentication.redirectfromloginpage(字符串,布尔值),我想在着陆页上检索此字符串值?



所以如何获得此字符串值在登陆页面上?

解决方案

登录按钮点击事件传递



会话[username] = txtusername.text; 





在您的目标网页上使用该会话 Page_Load



就像你使用Lable那样..



 lable1.text = session [username]; 


  string  A =  string  .Empty;(本地变量)

if (User.Identity。 IsAuthenticated)
{
A = User.Identity.Name;
}







只返回在formsauthentication.redirectfromloginpage中传递的字符串值( string,Boolean)



ex:formsauthentication.redirectfromloginpage(TEST,True)



将返回Test in甲


i am using formsauthentication.redirectfromloginpage(string,Boolean) and i want to retrieve this string value on landing page ?

so how can i get this string value on landing page ?

解决方案

On login button click event pass

session["username"]=txtusername.text;



And In your Landing Page use that session on Page_Load

like if you used Lable then..

lable1.text=session["username"];


string A= string.Empty;(local variable)

               if (User.Identity.IsAuthenticated)
               {
                   A =  User.Identity.Name;
               }




simply returns the string value that has been passed in formsauthentication.redirectfromloginpage(string,Boolean)

ex: formsauthentication.redirectfromloginpage(TEST,True)

will return Test in A.


这篇关于在登陆页面上获取用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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