How can I get a Response.Write and Response.Redirect to work one following the other?

I have a button on my webform that needs to perform 2 operations.  First it must open a new window which I usually do like this: 

sJScript = "<script>window.open('Form01.aspx?ID=0&Parent=5', '', '');</script>"
Response.Write(sJScript)

Second it must redirect the current page (not the newly opened one).  I usually do that like this:

Response.Redirect("Form02.aspx?ID=6")

My problem is, in this case, I must do both with one button click and they interfere with each other.  I've tried flushing/ending the response object in various places, re ordering things, etc but none of those work.  I either end up with the redirect but no new window, a new window but no redirect, or whichever one is first and an error when the second tries to go because I've killed the response object somehow.

How do I accomplish this?

0
KenP2600
7/28/2005 7:49:59 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
1532 Views

Similar Articles

[PageSpeed] 48

try using JavaScript for redirect as well, but put it on a timeout:

sJScript  = "<script>window.open('Form01.aspx?ID=0&Parent=5', '', '');";
sJScript += "setTimeout("location.href='Form02.aspx?ID=6'", 500);";
sJScript += "</script>";
Response.Write(sJScript);

I didn't test that, so I can't guarantee the Timeout part.
0
northflacomps
7/28/2005 8:50:16 PM
Thanks for the tip.  The timeout worked great.  I appreciate the help.
0
KenP2600
8/15/2005 1:35:19 PM
Reply:

Similar Artilces:

Response.write and response.redirect working together.
In my If then else statement I have 2 statements that are if true i need to pop up a message box and then when they hit ok, redirect them to another page.  so here is the statements and below that it show how I tried to use some code in the statment, but what happens is on the second statement the pop-up will not come up but it will wait 10 seconds and then redirect itself. ElseIf txtStatus.Text = "AGR PERM" Or txtStatus.Text = "AGR TEMP" Then       Page.RegisterStartupScript("LoadFunction", "<script type='text/ja...

Can not get Pickup Directory... .net can't access metabase maybe??? Need to get working ASAP
I am using 2.0 to try to send an email to the IisPickup directorySystem.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(test@testing.com, "test@test.com", "Testing " + DateTime.Now.ToString(), "Testing the Mail Drop Folder");System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("127.0.0.1");client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis; client.Send(message);Example Site : www.andrewworral.com (hit the button)This code worked on our old deployment server but not on our new server.  I s...

getting Panels to work with Response.Write()
I am using panels to with my contents with and realised that when I use Response.Write(), the <asp:panel> does not translate into <div> tags on the client side. My test code in test.aspx are: <asp:panel runat="server">test<br /></asp:panel> <% Response.Write("<asp:panel ID=\"Panel1\" runat=\"server\">test<br /></asp:panel>"); %> When it gets loaded in a browser, the source of the test.aspx page shows the following:    <div> test<br /> <asp:panel ID="Panel1" runat="server">test<br />&l...

Response.write or Response.redirect?
I have a code using Response.Write and javascript to open another page, the code looks like this: Response.Write("<Script language='javascript'>window.open('http://10.10.30.25:8080/Orders/Orders.aspx?vloc=fac&vflag=" & Session("varflag") & "&vid=" & Session("FacilityID") & "&vrepid=" & Session("varid") & "');</script>") it send me to another page in a different window or tab. I want to open it in the same window or tab as in Response.Redirect, but in Respons...

How to get the value from one page to another page when i use response.redirect
I have two webforms, webform1 and webform2i am doing the response.redirect on webform1 to get onto webform2.I am doing the following:response.redirect("webform2.aspx?ID=23")Now on webform2.aspx i only have Javascript functions.How can i get the value of my response.querystring("ID") into the javascript function.I am calling this javascript function of forms onload.I have the functions on the html window only not using the vb.net code behind.Please i have real difficulty. Help me.Thank you very much for the information. Hi,Try below code in your webform2.aspx. Private Sub Page_Loa...

Response.Redirect after response.OutputStream.Write?
I'm using the Wrox Docs module from Building An ASP.NET Intranet. This code outputs the doc from the DB to the client Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ItemID As Integer = -1 Dim strTable As String = "parent" Dim DocsSec As New WroxDocSecurity() 'comment this code if you don't want to lock down the download process If Not (DocsSec.HasDocPermissions(DocumentPermissions.DownloadandViewOnly, Request.Params("key"))) _ ...

I can't get no cache, I can't get no cache. 'Cause I try and I try and I try and, I can't get no, I can't get no cache.
I have fiddled out for days tinkering with the setting in about:config trying to get FireFox 12 to use the disk cache. I have NOT found the trick. This One Trick Pony ain't doing it like it used to up until recently. Pray tell anyone, What information can I share that will point a knowledgeable person to aid me in getting FF to disk.cache? I have also tried restarting FF with add-ons disabled, (There were NOT too many to do this to, so it was quick and easy) Here is my stab at trying to convey the information that MIGHT govern matters Using about:cache Informatio...

Why I can't get back to the page I want by use Response.Redirect(path)?
My code is below , my problem is ... the code works find except I add the "" I was thought page should back to the list page () after the comfirmd message Box is return "true" yes, after I add the code (Line 10) , page did return the List page , but before it returned , is shows a error message why? can you please help me to fix my code to avoid system show the error message again? thank you very much  1 protected void btnSave_Click(object sender, EventArgs e) 2 { 3 try 4 { 5 ................... 6 ...

Re: I can't get no cache, I can't get no cache. ' Cause I try and I try and I try and, I can't get no, I can't get no cache.
<div>please com e see me about htis<br /> <br /> ------- Original Message f= rom the Global Relay Archive -------<br /> From: Hp &lt;ferd@farkel.net&gt;= <br /> To: "support-firefox@lists.mozilla.org" &lt;support-firefox@lists.mo= zilla.org&gt;<br /> Sent: Sun, 27 May 2012 18:30:18 -0700<br /> Subject: I = can't get no cache, I can't get no cache. 'Cause I try and I try and I try = and, I can't get no, I can't get no cache.<br /> <br /></div> <pre class=3D"gr-maex-body-pre&qu...

Can't get it to work. Can't get help.
Name: Tony Clarke Email: minionataondotat Product: Thunderbird Summary: Can't get it to work. Can't get help. Comments: Installed T'bird. Had to change defunct server that T'bird selected by default. Kept asking for passwords associated with previous email (Outlook Express ), when passwords entered then got error messages saying aon responded with 're-authentification failure'. Searched your knowledge base & help forums to no avail. Found them very user-unfriendly & ended up more confused than before. Would like to try T'bird, but I think ...

Response.Redirect & Response.Write issues
I have code in my image click event which opens a new window when the end user clicks on the image. I need a new page/tab to open up and below is one version of how i do it. The issue l have is this always get stopped by the popup blocker and l want it to open up a new tab without forcing the popup or loosing the initil page!! protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Code here connects to Access and does its job then below is actioned......... try { conn.Open(); sdc.ExecuteNonQuery(); st...

No response from response.redirect
Hi, my asp.net project has atleast 10 webforms and for navigation the response.redirect was working fine till today. It stopped working in one of the pages but stills fine in the other pages. eg. the CANCEL button loads the previously navigated page. All CANCEL except one are working. I checked the button click event, put labels with messages in them; the labels get posted when the button is clicked; but when i remove the labels and put in the response.redirect("PAGE NAME") it stopped working; i even put the wrong path in the response.redirect, still the errorhandler or any o...

Can't get redirect to work work in manifest.webapp
--047d7b2e48583a6db30511ea1b00 Content-Type: text/plain; charset=ISO-8859-1 I'm building an OAuth2 browser auth dialog in FxOS 2.0.0 and following the instructions here: https://developer.mozilla.org/en-US/Apps/Build/Manifest#redirects "redirects": [ {"from": "http://example.com/firefoxos-redirect.html", "to": "/oauth-close.html"} ] I've got it working on a regular browser perfectly. For the Firefox OS version I swap out the real domain with the fake example.com as seen here: var myAppId = '1234567890&...

superreview requested: [Bug 127461] Get New Messages stops working for one account : [Attachment 157755] Proposed patch
David Bienvenu <bienvenu@nventure.com> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 127461: Get New Messages stops working for one account http://bugzilla.mozilla.org/show_bug.cgi?id=127461 Attachment 157755: Proposed patch - Implements a pop3 response timer to drop hung connections http://bugzilla.mozilla.org/attachment.cgi?id=157755&action=edit ...

Web resources about - How can I get a Response.Write and Response.Redirect to work one following the other? - asp.net.getting-started

Lost MLK, Jr. speech recovered from his Nobel Peace Prize days
Just days before Dr. Martin Luther King, Jr. became the youngest person to ever receive the Noble Peace Prize, he delivered a speech in London ...

U.S. 'stuck to its guns' on Iran prisoner swap: freed detainee's brother
(Reuters) - Iranian authorities "continued to manipulate" Washington Post reporter Jason Rezaian until the moment he was released with four other ...

Amy Schumer Slams Kid At Critic’s Choice Awards Who Made ‘Whore’ Joke About Her On Twitter, But Did He ...
Amy Schumer went off on a fan who posted a photo on Twitter of the pair of them together at the Critic’s Choice Awards with a questionable caption ...

Why It's Misleading to Say the 62 Richest People Have the Same Wealth As Half the World
Much of the money the global rich have does not exist on this planet. Tyler Olson/ shutterstock The story presently making the rounds in business ...

Lady Gaga’s Response to Cyberbullies Is an Example Worth Following
Lauren Bohn, one of Gaga's NYU classmates, revealed the online vitriol in a Facebook post of her own over the weekend.

WhatsApp Is Now Free For Everyone, No Subscription Required
WhatsApp is one of the most popular alternative messaging apps in the world, despite charging most users $0.99 per year. Now, that fee is going ...

SpaceX Fails To Land Rocket On A Ship Yet Again
SpaceX has already tried to land its Falcon 9 reusable rocket on a floating ship in the ocean multiple times and, unfortunately, it has not been ...

Should Denver start Peyton Manning against the Patriots?
I think this is a serious question in theory, and ought to be one in practice, but I would be shocked if Gary Kubiak will give it any consideration. ...

Astronomers unofficially designate a David Bowie constellation
Studio Brussels asked astronomers at Belgium's MIRA Public Observatory to select stars that would make a fitting constellation in memory of David ...

Utah Officer Was Paying off Cancer Bills When He Was Killed
Officials say the veteran Utah police officer who was working overtime to pay for his cancer treatments was shot to death by a fugitive who went ...

Resources last updated: 1/18/2016 9:52:39 PM