Solved

c# - Close Internet Explorer window

Posted on 2006-10-23
5
2,845 Views
Last Modified: 2012-05-05
Hi.  I'm looking for a line of C# code that would automatically close my .aspx page.
Thanks.
0
Comment
Question by:cberinger
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:yotamsher
ID: 17791775
in your .aspx code?
0
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 500 total points
ID: 17794263
ClientScript.RegisterStartupScript(this.GetType(), "CloseScript", "self.close();", true);

The last argument makes sure that this script code gets surrounded with script tags, so it depend where you put this line in your code...
0
 

Author Comment

by:cberinger
ID: 17795335
Looks good, but the IE window is awaiting a response from the client to close the window.  The problem is that this needs to be unattended.  

All of my code is located in my c# file.  There’s nothing in the .aspx file.  The only reason I run it as an .aspx page is because that’s all I’ve ever done.  Is there a quick way to attach my code to an .exe that will run & close?
0
 
LVL 19

Expert Comment

by:Albert Van Halen
ID: 17795932
Well, you cannot attach your 'server-side' code to a 'client-side' executable and run something.
Thank god for that !!

It's default behavior of IE. You can not change that.

See also this post
http://www.experts-exchange.com/Web/Web_Languages/Q_21981035.html
0
 
LVL 7

Expert Comment

by:yotamsher
ID: 17797314
What is it doing?
If it is not supposed to communicate with the server, but just run something, then offcourse you can wrap it as an exe, but then, how will it get to the client machine?
You need to be specific

Yotam
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ejb message driven bean mdb creation steps 2 23
Using Third Party DLL with Access VBA 14 41
Selenium docs api java index 3 48
Vector, list Questions R 6 32
This article will show, step by step, how to integrate R code into a R Sweave document
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question