Solved

Close ASP.NET web page using C#

Posted on 2004-08-12
10
2,499 Views
Last Modified: 2012-05-05
Hey,

   Does anybody know how to close ASP.NET .aspx web page using C# code.

   I have a .aspx popup that I want to close after finishing work. Something like window.close() in javascript. Does c# have anything like this?

  Thanks.
0
Comment
Question by:payal1711
  • 5
  • 5
10 Comments
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11790237
Hi payal,
how are you... been a long time , haan ??...  
Well,  closing a window is a Client-Side operation.... so you can't do it from server side code. Have to use client side code (use javascript)...
You see, closing or starting any application in client computer is not possible from server side code (otherwise creating VIRUS would be far easier). Usually people go for javascript for these kind of client side operations.

I would rather use, say , a Button...  and in page_Load...
        Button1.Attributes.Add("OnClick", "javascript:self.close()")

-Baan
0
 
LVL 1

Author Comment

by:payal1711
ID: 11794761
Hey Baan,

   How are ya? yeah, long time since the last email.

   yes i came to know that yesterday when I was looking on the net after posting this question here. I got the code with Response.write and wrtie the javascript code as part of its argument. but that closes the window before my job is done. so there is a problem there and it doesnt launch the animated gif image that shows processing.

   Baan, I was wondering how to expedia and orbitz and other online reservation sites do this. You must have seen that when we select the options and hit search another page open up which shows processing and when it has results the window closes itself. I wanted to do something like that.

   ~Payal
0
 
LVL 1

Author Comment

by:payal1711
ID: 11796247

  Does anyone know javascript on how to open new pop ups every time a button is clicked? I dont want the page to be launched on the same pop up window everytime.

   I am opening the pop up window on button click event.

  Thanks,
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11796520
ok.. add attribute to the button in the Page_Load...

Button1.Attributes.Add("OnClick", "javascript:window.open('PopUpWindow.aspx','MyPopUp','width=440,height=480,left=270,top=100')")
-Baan
0
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 50 total points
ID: 11796686
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11796701
0
 
LVL 1

Author Comment

by:payal1711
ID: 11798259
hey,

   Thank you for sending all those links. Now I know the problem in my code and have solved it partially.

        The problem is because the server is processing and I have put the thread to sleep, the animated gif doesnt show up on the page. It simply hangs. And if I refresh that page, then my whole program functionality is messed up there after.

        What option do I have?

      Payal
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11798443
I am not sure about that... 'cause I never done that. Well, few days back there were couple of discussion,here in EE, that had the same thing you want to do. I will try to find those PAQs and I will send you the links... that might help.
-Baan
0
 
LVL 1

Author Comment

by:payal1711
ID: 11812146
Thank you Baan,

    I will wait for the links.

  Payal
0
 
LVL 1

Author Comment

by:payal1711
ID: 11824510

 Well, it seems that we are not continuing with this idea as popup blocker blocks the window and the work is not done therefore. Thanks for the help Baan.

    Payal

 
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

20 Experts available now in Live!

Get 1:1 Help Now