The 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