Re: OnUnload event
From: SevDer (dotnet_at_sevder.com)
Date: 09/11/04
- Next message: Diego_Atos: "Re: timer too slow... why?"
- Previous message: Robert Hooker: "Re: Late Construction via Reflection & instance variable initializers"
- In reply to: Viktor Popov: "OnUnload event"
- Next in thread: Viktor Popov: "Re: OnUnload event"
- Reply: Viktor Popov: "Re: OnUnload event"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 11 Sep 2004 13:02:22 -0400
Viktor Popov wrote:
> Hi,
> Iwould like to do that. Is it possible because I can't do it?
> in test.aspx file:
> <body onunload="signout()">
>
> in test aspx.cs
> :
> void private signout()
> {
> HttpContext.Current.Cache.Remove(Session["usrName"].ToString());
> Session["user"]=null;
> Session["usrName"]=null;
> FormsAuthentication.SignOut();
> }
>
> Is it possible to use C# function in onunload event.
> Please could you tell me hoe to implement this. I should use the code in
> signout() function when onunload event occures.
>
> Thank you,
>
> Viktor
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.760 / Virus Database: 509 - Release Date: 10.9.2004 a.
>
>
Viktor,
You are mixing server code with client code.
QUTOE
<body onunload="signout()">
UNQUOTE
This signout() method will run in the client script not code behind.
If you want it in code behind then you can open the hidden "Web Form
Designer generated code" region and in "InitializeComponent()" method
specifically define "this.Unload += new EventHandler(resBox_Unload);"
then if you do the tabbig that VS.NET suggests, it will also generate
the unload method for you and you can type in your code.
I hope this helps.
-- SevDer http://www.sevder.com
- Next message: Diego_Atos: "Re: timer too slow... why?"
- Previous message: Robert Hooker: "Re: Late Construction via Reflection & instance variable initializers"
- In reply to: Viktor Popov: "OnUnload event"
- Next in thread: Viktor Popov: "Re: OnUnload event"
- Reply: Viktor Popov: "Re: OnUnload event"
- Messages sorted by: [ date ] [ thread ]