Solved

c# - Close Internet Explorer window

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

Industry Leaders: 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

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 make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Simple Linear Regression

726 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