470,631 Members | 1,737 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

Closing browser window from server side in asp.net

Hi

I hope some one has an answer to this.

I have a button in an aspx page . On server click of this button, i perform
some operation. Once the operation is performed i want to close this window
automatically.

Pls help
Sileesh
Nov 18 '05 #1
3 13362
i don;t think you can literally close a browser from a server side script.
what you can do instead is to pass a client side script after you've done
your process on the server side..

sample..
private sub Button1_Click()

--do your server side processing here.

--after you're done load the close window script
Dim strscript As String = "<script
language=javascript>window.top.close();</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strscript)
End If

end sub

hope this helps..
"Sileesh" wrote:
Hi

I hope some one has an answer to this.

I have a button in an aspx page . On server click of this button, i perform
some operation. Once the operation is performed i want to close this window
automatically.

Pls help
Sileesh

Nov 18 '05 #2
HI Allan

Thx. It works great.

"Allan" wrote:
i don;t think you can literally close a browser from a server side script.
what you can do instead is to pass a client side script after you've done
your process on the server side..

sample..
private sub Button1_Click()

--do your server side processing here.

--after you're done load the close window script
Dim strscript As String = "<script
language=javascript>window.top.close();</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strscript)
End If

end sub

hope this helps..
"Sileesh" wrote:
Hi

I hope some one has an answer to this.

I have a button in an aspx page . On server click of this button, i perform
some operation. Once the operation is performed i want to close this window
automatically.

Pls help
Sileesh

Nov 18 '05 #3

Sileesh wrote:
HI Allan

Thx. It works great.

"Allan" wrote:
i don;t think you can literally close a browser from a server side script. what you can do instead is to pass a client side script after you've done your process on the server side..

sample..
private sub Button1_Click()

--do your server side processing here.

--after you're done load the close window script
Dim strscript As String = "<script
language=javascript>window.top.close();</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then Page.RegisterStartupScript("clientScript", strscript) End If

end sub

hope this helps..
"Sileesh" wrote:
Hi

I hope some one has an answer to this.

I have a button in an aspx page . On server click of this button, i perform some operation. Once the operation is performed i want to close this window automatically.

Pls help
Sileesh


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Theo | last post: by
13 posts views Thread by Kai Grossjohann | last post: by
11 posts views Thread by danny | last post: by
1 post views Thread by Chirag Malvi | last post: by
5 posts views Thread by Uma Muthu | last post: by
1 post views Thread by King Coffee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.