Solved

Close ASP.NET web page using C#

Posted on 2004-08-12
10
2,515 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
[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
  • 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
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!

 
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
 
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

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

628 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