Re: Windows Authentication: LogoutAug 19, 2009 09:23 PM|LINKThe way to do this is to use Javascript, not ASP.NET. Credit goes to a tip I read here.Here's the code to put in your ASPX page.HEADER SECTION<head runat="server"> <title>Header</title> <script language="javascript"> if(self.location==top.location)self.location="Default.html"; function Logout() { try { if(window.XMLHttpRequest) { alert("You have been logged off from this website. Note that if you run Internet Explorer 6.0 without Service Pack 1 you need to close all browser windows in order to complete the log off process."); document.execCommand("ClearAuthenticationCache", "false"); if (top.location != location) { top.location.href = "." ; } } else { alert("This feature requires Internet Explorer 6.0 Service Pack 1 or above. " + "Please close all browser windows in order to complete the logout process."); } } catch (e) { alert("This feature requires Internet Explorer 6.0 Service Pack 1 or above. " +"Please close all browser windows in order to complete the logout process."); } } </script> <link href="styles/StyleSheet.css" rel="stylesheet" type="text/css" /> </head> BODY SECTION<body> <div style="position: absolute; width:99%; text-align:right; left: 0px; top: 54px; z-index: 100;"> <asp:HyperLink ID="HyperLink1" runat="server" Style="z-index: 102; right: 10px; position: absolute; top: 0px" NavigateUrl="javascript:Logout()" Width="40px">Logout</asp:HyperLink> </div> </body> Rizwan Gulamhussein
user.isinrole 这个不起作用
web.config 配置也不起作用。为什么???????
window.close();这个是win form 的吧,我这里讨论的是asp.net
windows 验证 不是 form 验证
http://topic.csdn.net/u/20100519/21/d81f5c49-b7a5-4716-9693-de452dd4cb67.html?89306
我有回复 应该也是那种情况吧
<title>Header</title>
<script language="javascript">
if(self.location==top.location)self.location="Default.html";
function Logout()
{
try
{
if(window.XMLHttpRequest)
{
alert("You have been logged off from this website. Note that if you run Internet Explorer 6.0 without Service Pack 1 you need to close all browser windows in order to complete the log off process."); document.execCommand("ClearAuthenticationCache", "false");
if (top.location != location) {
top.location.href = "." ;
}
}
else
{
alert("This feature requires Internet Explorer 6.0 Service Pack 1 or above. " + "Please close all browser windows in order to complete the logout process."); }
}
catch (e)
{
alert("This feature requires Internet Explorer 6.0 Service Pack 1 or above. " +"Please close all browser windows in order to complete the logout process."); }
}
</script>
<link href="styles/StyleSheet.css" rel="stylesheet" type="text/css" />
</head> BODY SECTION<body>
<div style="position: absolute; width:99%; text-align:right; left: 0px; top: 54px; z-index: 100;">
<asp:HyperLink ID="HyperLink1" runat="server" Style="z-index: 102; right: 10px;
position: absolute; top: 0px" NavigateUrl="javascript:Logout()" Width="40px">Logout</asp:HyperLink>
</div>
</body>
Rizwan Gulamhussein