Test your technical skills online, appear in Virtual Interview and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Make friends on DotNetFunda.com and expand your network!
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Forums Author
Wed, 23-Apr-2014 Authors
Saranpselvam
20
Sheonarayan
10
Sivakumar.S
10
All Time Authors
Jayakumars
3930
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)

Browser[X] button prob.. asp.net

Susantaown
Posted by Susantaown under ASP.NET on 8/19/2009 2:00:55 AM | Views : 1055 | Status : [Member] | Replies : 1
Hi All

I Want to use one method in Browser [X] button.. but its not working here is code ..

I use this shot of code in Master.aspx page
--------------------------------------------------
<body onunload="signOut();">

<script type="text/javascript" language="javascript">
function signOut()
{
PageMethods.signOut();
}
</script>



<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />


in .cs file the method is
------------------------------
public void signOut()
{
Session["UserName"] = null;
Session["UserName"] = "";
Session.Abandon();
FormsAuthentication.SignOut();
Response.Redirect("~/Logon.aspx");
}


Can any body suggest why its not working for browser [X] button..

the same method working for my Logout Button. but if the user close the browser i want to call this method..

Need a quick help...?

susant



Reply | Reply with Attachment

=> Scroll below for responses


Comments or Responses

Posted by: Raja on: 8/19/2009 [Member] Starter

You may need to declare signOut method as WebMethod.

[WebMethod]

public void signOut()
{
Session["UserName"] = null;
Session["UserName"] = "";
Session.Abandon();
FormsAuthentication.SignOut();
Response.Redirect("~/Logon.aspx");
}


Look for this article to see how a PageMethod is called.

http://www.dotnetfunda.com/articles/article454.aspx

Thanks

Regards,
Raja, USA

Susantaown, if this helps please login to Mark As Answer. | Alert Moderator


Login to post response.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: