Solved

c# - Close Internet Explorer window

Posted on 2006-10-23
5
2,841 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scoreUp challenge 14 56
mapBully challenge 6 113
Eclipse Neon start with Admin account only 6 91
C# code editing and collaboration 3 98
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

914 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now