Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Close ASP.NET web page using C#

Posted on 2004-08-12
10
Medium Priority
?
2,517 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
Independent Software Vendors: 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

916 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