我想在登录成功后将登录页面的用户名显示在受尊重的重定向页面上。 [英] I want to display the username of Login Page on to the respected redirect page after successful login.

查看:50
本文介绍了我想在登录成功后将登录页面的用户名显示在受尊重的重定向页面上。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在登录成功后将登录页面的用户名显示在受尊重的重定向页面上。为此,我在重定向页面上取了一个标签,显示用户名sholud。

I want to display the username of Login Page on to the respected redirect page after successful login.For this i had taken one label on redirected page on which the username sholud be get displayed.

推荐答案

您可以在成功登录后在会话中存储UserName,并在所有页面中使用它。

在显示部分,您也可以使用MasterPage,这意味着您不要不必在每个单独的页面中使用标签/文字。
You can store the UserName in Session after successful Login and use it across in all the Pages.
And on the displaying part you may use MasterPage also, which means you don't have to use Label/Literals in each Individual Pages.


验证用户名之后重定向到另一个页面保留上下文中的用户名



即Context.Items.Add(UserName,你的用户名);



用txtUsername.Text替换你的用户名。



重定向页面



In!isPostBack



lblUserName.text = Context.Items [UserName]。toString();
After Validating the Username Before redirecting to another Page keep username in Context

i.e Context.Items.Add("UserName","YOur User Name");

Replace Your User Name With txtUsername.Text.

In Redirected Page

In !isPostBack

lblUserName.text=Context.Items["UserName"].toString();


读取和探索: ASP.NET Web应用程序中的页面和应用程序上下文 [ ^ ]


这篇关于我想在登录成功后将登录页面的用户名显示在受尊重的重定向页面上。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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