Todd,
1. Usually on the button click you clear out your session variables, and
then redirect (with this.Response.R edirect(another PageRelativePat h)) to
another - say, home - page.
2. If you opened your application in a new window with javascript, then you
could just use <input type='button' value='Close' onclick='if (confirm('are
you sure?')){top.cl ose();}return false;'/instead of your asp:button. This
will close the opened browser window without even hitting the server. You
will not have a chance to clear out session (and/or cache) variables,
however. You can change the confirmation text or remove it altogether, if
needed.
3. If you need to do both: clear the variables and close the browser window,
then you need to use asp:button and on its server click event clear all
necessary variables and change Response to something like:
this.Response.C learContent();
this.Response.W rite(@"<html>
<head>
<script type='text/javascript' language='javas cript'>
<!--
top.close();
// -->
</script>
</head>
<body />
</html>");
this.Response.E nd();
Both 2. & 3. assume that javascript is enabled - otherwise it will not work.
hope this helps
"Todd Jaspers" wrote:
Hey guys,
I've developed a C# Web Form using Visual Studio 2005. I can't quite
figure out how to exit the form though??? On my form, I have a button which
says "CLOSE". I'd like for someone to be able to click that, and then have it
automatically just exit out of the application. How do I do that?
This is my on event procedure, what should be in here???
protected void btnClose_Click( object sender, EventArgs e)
{
// Close;
}
Thanks!
Todd