?
Solved

c# - Close Internet Explorer window

Posted on 2006-10-23
5
Medium Priority
?
2,849 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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…
Introduction to Processes
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 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