Closing a window ASP.NET

  • Thread starter Thread starter Fred Esmaeili
  • Start date Start date
What is the C# code to close a web form?

Thanks for help
Fred

Send back a page that crashes the browser?

Alternately send a page that has a javascript execute in body on load
that closes the browser. I'm not sure you can do this though
 
Hi Fred,

You can try to register some startup script to the web form like the
following.

string strClose = "<script>" + "window.close()" + "</script>";
Page.RegisterStartupScript("close", strClose);

Foro more information about Page.RegisterStartupScript method, please refer
to the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemWebUIPageClassRegisterStartupScriptTopic.asp

You can also find how to use client side functionality in a server control
in the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconclient-sidefunctionalityinservercontrol.asp

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "Fred Esmaeili" <[email protected]>
| Sender: "Fred Esmaeili" <[email protected]>
| Subject: Closing a window ASP.NET
| Date: Thu, 6 Nov 2003 10:47:20 -0800
| Lines: 4
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOklmjc+xDQGl0XQaevrhYYYERk3Q==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:65674
| NNTP-Posting-Host: TK2MSFTNGXS01 10.40.2.125
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| What is the C# code to close a web form?
|
| Thanks for help
| Fred
|
 
Back
Top