Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 5th, 2007, 12:31 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default Close box

Guys I have a log out button, and I need it to sign off the user, at the same time I have a session that sign off the user automatically when timeout. but I still need to stop the user from closing the browser through the close box, so how can I do that?



Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
__________________
Nothing is impossible. The impossible only takes longer. \"Digital Fortress, Dan Brown\"
 
Old September 5th, 2007, 02:19 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi Zaghmout!!
offcourse you can do it at some level.
I tried it for IE ,hope this will help you.

Plz let me know if u have other choice
<html>
<head>

<script>

function closeSession()
{
 //capturing ALT + F4
 if (event.altKey==true && event.keyCode==0 )
{
   alert("closed1")
   return true
   }

//capturing close bttn
Xwidth=window.document.body.offsetWidth-window.event.clientX
YHeight=window.event.clientY
if(Xwidth<=30&&YHeight<0)
{
   alert("closed2")
   return true ;

}

}
window.onbeforeunload=closeSession

//or we can use body(unload) method

</script>

<script>
 function fwd(field){
 var val=field.value;

alert(val)
 }
</script>
</head>
<body>
<select id="myPage" onchange=fwd(this)>
<option value="1">one1</option>
<option value="2">one2</option>
<option value="3">one3</option>
</body>
</html>

Cheers :)

vinod
 
Old September 5th, 2007, 03:54 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks vinod, I tried it and it worked, but the problem is if the user was as stupid as I imagin he will be, he will press ok without reading the message, and that will close the browser :s

so is there anything i can do about that?




Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close when screen saver close Rehanrana Pro VB 6 1 April 7th, 2008 03:09 AM
close window with out message box cesemj ASP.NET 1.0 and 1.1 Basics 10 October 2nd, 2007 09:23 AM
close window with out message box nutrino ASP.NET 1.0 and 1.1 Basics 2 December 6th, 2005 04:26 PM
window.close() failing to...well...close! mheathcote Javascript How-To 2 October 31st, 2005 03:02 PM
Programmatically close a message box 12th_Man VB How-To 3 June 25th, 2004 05:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.