Server side operation from javascript

R

RJN

Hi

I want to do some server side operation on close of a browser. I created
a server side html button and invoked a post back event on close of
browser something like
__doPostBack('btnUnlock',''); What I realised this is unreliable as the
operation is yet not completed when the browser has closed and
essentially the thread would have been killed. Is there any way in
javascript wherein I post a message to the server, wait for the response
and then the window closes something like send message and wait for the
response.

Regards

RJN
 
L

Lucas Tam

RJN said:
Is there any way in
javascript wherein I post a message to the server, wait for the response
and then the window closes something like send message and wait for the
response.

There is no way to ensure this will fire. Client side javascript can be
disabled or stopped in many ways.

Instead, use the Session End event handler in the Global.asax.
 
E

Eliyahu Goldin

Yes, there is a very simple way. Post your message (it doesn't have to be
hacker style _doPostBack, it can be any value passed to the server in one of
legal and documented ways) and, in the response, get server-side to emit
window.close() javascript statement.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top