使用C#的Web应用程序中的登录状态 [英] login status in web application using c#

查看:147
本文介绍了使用C#的Web应用程序中的登录状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请帮助我如何在母版页中创建登录状态,该状态在登录时显示"LOGOUT",在退出时显示"LOGIN"?

Hi,
Please help me how to create login status in masterpage that will show ''LOGOUT'' when logged in and ''LOGIN'' when logged out??

推荐答案

已看看ASP.Net的成员资格和安全性. Google的结果是1000.

http://www.4guysfromrolla.com/articles/120705-1.aspx [ ^ ]

已经有可以完全满足您需求的控件

http://msdn.microsoft.com/en-us/library/ms178329.aspx [ ^ ]

登录状态控件 [
Have a look at ASP.Net membership and security. Google this, there are 1000''s of results.

http://www.4guysfromrolla.com/articles/120705-1.aspx[^]

There are already controls that do exactly what you want

http://msdn.microsoft.com/en-us/library/ms178329.aspx[^]

i.e. the Login Status control[^]


如果您使用链接按钮,
单击时重命名链接按钮;

意思是:-
注销时:-只需使用
重命名
If you Use Link Button,
the rename the link button at clicking;

means:-
when logout :- just rename it with
linkButton1.text="Login";


并清除Cookie和会话.
然后它将转换为登录名.
登录时:-只需使用
重命名


and clear the cookie and session.
Then it will Convert to login.
when Login :- just rename it with

linkButton1.text="Logout";


并在PageLoad()事件上
检查您的会话和Cookie:
如果是,则您已登录.
并重命名:-


and on PageLoad() event
check ur session and cookie :
if it is then then u R Logged in.
and rename:-

linkButton1.text="Logout";


默认情况下,以链接"按钮text =登录.

或者只是上传ur编码或Just Masterpage.


by Default Take Link Button text= Login.

Or Else just Upload ur coding or Just Masterpage .


登录后希望您必须在会话中保留userid

然后在母版页中检查if(Session["userId"]!=null)
表示您已登录,然后更改
After login hope you must keep userid in session

then in master page check if(Session["userId"]!=null)
means u are logged in then change the
linkbutton text ="Logout" <br />
else "Login"


这篇关于使用C#的Web应用程序中的登录状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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