如何使用带有母版页的c#通过asp.net中的anchot标签注销? [英] how to logout through an anchot tag in asp.net using c# which have a master page ?

查看:86
本文介绍了如何使用带有母版页的c#通过asp.net中的anchot标签注销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在母版页中有一个注销链接,并希望使用该锚标记注销用户。如何才能做到这一点?

任何帮助将不胜感激。

I have a logout link in master page and want to logout the user using that anchor tag. how can this be done?
any help will be appreciated.

推荐答案

同意第一个解决方案使用链接按钮代替锚标记



如果您真的想使用锚标记然后将Href设置为Aspx页面并在该页面上写入LogOut的代码。
Agreed With First Solution "Use Link Button Instead Anchor Tag"

If You Really Want To Use Anchor Tag Then Set Href To Aspx Page And On That Page Write Code Of LogOut.


选项很少,您可以将用户重定向到其他页面,例如Logout.aspx,并在该页面的页面加载时注销用户。检查

本答案获取更多信息 [ ^ ]

另一种选择是你可以使用Linkbutton代替或锚标签

There are few options, You can redirect user to some other page for example Logout.aspx and sign out the user on page load of that page. check
This Answer for more information[^]
Another option is you can use Linkbutton instead or anchor tag
<asp:LinkButton runat="server" Text="Log Out" OnClick="LogOut_Click" ></asp:LinkButton>



你可以在代码隐藏方法中注销 LogOut_Click


这篇关于如何使用带有母版页的c#通过asp.net中的anchot标签注销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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