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.........
string url = "";

Any thoughts anyone!!!!

Paul Bishop
P. Bishop
7/27/2008 1:35:18 PM 91979 articles. 4 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 6
Get it on Google Play
Get it on Apple App Store

Try to use the below code instead


Hope this helps,

Haissam Abdul Malak
| Blog |
7/27/2008 5:57:35 PM
The above script, reacted in exactly the same way, the popup blocker stopped the page 
from opening....
There must be some way of incorporating "_blank"?

Thanks so far though

P. Bishop
7/27/2008 6:43:06 PM

As far as I know, if you use, the popup blocker will hit you.

7/27/2008 8:28:18 PM

 Here is a simple article that shows how to detect pop up blockers. Maybe you can use that in your application to warn the user that their pop up blocker is enabled and they can turn it off:

Detecting Pop Up Blockers


Wanna get high!
7/28/2008 3:00:36 AM

Similar Artilces:

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>'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 n...

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'>'" & 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...

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"))) _ ...

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

No response from response.redirect
Hi, my 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...

Using Response.Redirect and Response.Write from flat class file
Setup: I developed an interface that holds certain functions that are shared between some users in my system. The different users are grouped into classes that implement that interface. Problem: In some instances the implementations of this interface include a mere write to the screen or a redirect. However, when I attempt to do something like Response.write or Response.redirect from those classes, I am getting an error that says "Response is not Available in this Context" Question: Is what I am trying to do possible and if so, how do I correct this problem. ...

I-Frame & response.redirect issue
using .NET 1.1  i have webform (Main.aspx) that contains an I-Frame & usercontrol, the usercontrol dictates what page is displayed within the I-Frame. within the pages within the I-Frame i need to re-direct to another page but this page needs to reload outside of the I-Frame, at the minute the response.redirect is loading the new page within the I-Frame. how do i make it load within the parent page and not the I-Frame Any help is greatly appreciated.Cheers,Craig I have not understood the prblem  correctly, but check this out... It may help you.   Writ...

issue with response.redirect code
 I have an if statement in my page load event that will check 2 global variables and verify they are set to a user name and user ID. If they are not they will redirect the user back to the log in page. The actual code is going into th IF statement, but not processing the response.redirect. Not sure why. I placed a msgbox in the part with this piece of code and it fires off, but my page does not go to my log in page like I want it to. I basically want to veify that someone is not going directly to that web page before logging in. This is working fine on my edit page. Any ideas why this w...

Won't let me use both Response.Write and Response.Redirect in same function?
Below is my code:Response.Write("&lt;script language='javascript'> ('Saved Form.htm' ,'NewWindowName', 'width=400, height=400, toolbar=no, resizable=no');</script>"); Response.Redirect("forms.aspx?Form=sale");  Those two lines are in a function. When that function is called it directly redirects me to forms.aspx without opening the new window first. How can I fix that so that it opens the new window and then redirects the user to a different page in the old window. Using Visual Studio 2005. Language: C# ...

What’s the difference between Response.Write() and Response.Output.Write()?
Response.Write() gives a formated output OR Response.Output.Write() gives a formated output. Friend, The difference between Response.Write() and Response.Output.Write() in ASP.NET. The short answer is that the latter gives you String.Format-style output and the former doesn't. The long answer follows.In ASP.NET the Response object is of type HttpResponse and when you say Response.Write you're really saying (basically) HttpContext.Current.Response.Write and calling one of the many overloaded Write methods of HttpResponse. Response.Write then calls .Write() on it's internal Text...

really have no idea with response.Response.Redirect("index.aspx?key=" & String1)
Hi All, I am really having hard time with this. I have a index aspx page which could receive a param from URL, here are exmples there are working very well, no problems. However, I have created another page URLRewriting.aspx Response.Redirect("index.aspx?key=" & string1) As a result, after redirecting , it is different with the one i want. This is just an simple page to redirect to another page. I really have no idea. Can anyone ...

Should we use Response.Redirect ( url, true) or Response.Redirect ( url, false) ?
Normally most of the time we use Response.Redirect (url). How is this different from Response.Redirect ( url, true) or Response.Redirect ( url, false) ? Also, what is the best form of Redirect to use when going to another page?sun21170 The second parameter of Response.Redirect is endResponse which is boolean value that indicates whether to stop running the current page.It depends on if you want to keep it alive or stop it.Thanks Mark post(s) as "Answer" that helped youElectronic ScrewWebsite||Blog|| In what situation, would someone pass a true for the endResponse ...

.net 3.5 SP1 issue on Server 2003 SP2. AXD response getting truncated
My application runs great on my XP Pro development box. I've tried to deploy to both our hosting facility and to a duplicated local environment on Server 2003. In both cases, I've run into an issue were the calls to WebResource.axd and ScriptResource.axd are having their responses truncated. When I browse the site using IE with the Nikhil Dev Helper installed and compare to a run against my XP box that works, the log is showing me all those axd calls are getting their responses truncated to just 2048 bytes. The http response packet is showing the correct content len...

Response.WriteFile vs Response.Write
Hey guys...  I am using a FileUpload control and trying to display the pdf file. I can't get it to show the pdf file when I use Response.Write. But if I save the file to a directory and use WriteFile instead I can get it to work.  What does WriteFile do differently? Response.Clear(); Response.ContentType = "application/pdf";byte[] arrBytes = new byte[fUpload.PostedFile.ContentLength];Stream oStream = fUpload.FileContent; oStream.Read(arrBytes, 0, arrBytes.Length);Response.Write(new ASCIIEncoding().GetString(arrBytes)); Response.Flush(); Response.End();  response.writefile is for displaying a files contents, it requires a file to read from. Response.write simple writes text to the page.------------------------------------------------Jeff Turner (simpleModus)Don't forget to mark the correct answer for yourquestion to help out future visitors! I found the answer to my own question! I needed to use a BinaryWriter to the page. But what is the difference between BinaryWrite and using the GetString method as shown above? Response.Clear();Response.ContentType = "application/pdf"; Response.BinaryWrite(fUpload.FileBytes); Response.Flush(); Response.End(); Response.Write : You write a string into the Response ObjectResponse.WriteFile: Used for sending file to the client machine (download). It buffers the file into the server's Memory.I recommend using Response.TransmitFileHC Haissam Abdul MalakMCAD.NET| Blog...

UpdatePanel and Response.Write / Response.TransmitFile
I think I may be missing something obvious here, there are many posts about not using Response.Write to write to the page within an UpdatePanel. But how can I generate and transmit a file to the client while inside an UpdatePanel? For example, a page might be laid out like this:<Updatepanel><Selection Controls><Button><Table/></UpdatePanel>The purpose of the Button is to allow the client to simply export the data from the table:    Protected Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button.Click  &nbs...

Not able to use Response.write for writing to Excel, when using Response content compression
We have the Excel download option for our page, for which we use Response.ContentType as application/ and writing the data to Excel stream using Response.write.  As we apply Respone fileter for compressing the response content, this is not working. Considering the performance we don't want to disable the compression.  can anyone give some suggestions? Thanks in advance.     Disabling the compression for these particular requests would be OK, wouldn't it?However, a compressing response filter should not be a problem, even with application/vnd....

Using Response.Redirect() after Response.Flush()
I wonder if anyone might be able to help me with a problem I'm having in redirecting to a new page after calling Response.Flush(); The problem has arisen as a side effect of implementing a "Please Wait..." page that displays when clicking on a Search button. The following code is executed when the button's Click event is run: private void btnConfirm1_Click(object sender, System.Web.UI.ImageClickEventArgs e) { btnConfirm1.Visible = false; Response.Buffer = true; FileStream oFile = new FileStream(Request.PhysicalApplicationPath + "/Con...

Problem with .net elements in Response.Write
I need to do a response.write on an aspx page in , where as the response.write will display on "if" condition. I'm trying to display an Iframe that contains another file, with querystring parameters. Even when I double up/escape the quotation marks, still get a "String constants must end with a double quote" error on this line: <%= response.write("<IFRAME src=banners/nv-A1List.aspx?zone=<%=request.querystring(""zone"")%> name=banner width=234 height=60 frameborder=no border=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=no>...

Response.Redirect I can't get response.redirect to work anymore. I found another post with a solution, but that doesn't do anything except give me javascript errors. The given solution is to change Response.Redirect("page.aspx") into something like this: string script = "window.location.href='" + page + "';"; Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect", script, true); When I try to do this I just get the ubiquotous "object required" javascript error. I need to be able to redirect my users...any ways to do this when using Atlas? DavidNever underestimate the power of a ...

response.redirect issue
i have a page called search.aspx. When i enter /cv in the url of the page it takes me to the home.aspx page with the details of cv loaded in the page. when I do some changes inside and again enter something like /sibm in the url and click on go button. It do not goes back to the codebehind of homepage.aspx and instead it loads the home.aspx with the details of cv and not with the details of sibm How to resolve this problem   NOTE: I used Response.redirect method to go to home.aspx from search.aspx  please helpsarvesh What is this Go button?? Can ...

Response.Redirect issue
Hi, I'm trying to do a response.redirect and I have an "#" anchor sign after it. The issue is when I do the redirect, the "#" is ignored! I have two pages doing it, one page works and one doesn't, so I debugged it a litttle bit and found out that the page doesnt' work is because it has a "FileUpload" componet in it. here is a quick test. (With FileUpload, it doesn't work. WIthout FileUpload it works). Anybody has any clues to this?  Btw, in firefox, with fileupload or with fileupload, url has the "#" sign and  it's okay. It's weird to me because there is no client code here. I don'...

Hello, I know that it is possible to send information to a client page during a postback, via the Page.Response.Write( ... But, IS SUCH A THING POSSIBLE outside a postback ... I mean ... if I have an asynchronous thread running in my page, Is it possible to send a page refresh command to the client (for example ...) when this asynchrounous method is finished ??? or is it necessary to to such a response.write aftrer a client request ... If not,... Is there a way to do what I want ??? because now, I have tried to do this , and I have had a : "Response is no...

Response.Redirect issue
I have a very strong problem. I have a web form (ASP.NET 1.1 standard, not mobile). This form has an button that does a normal post back. The button's event handler checks the user input and if valid it will direct them to a new page using response.redirect. The page being directed to is a part of this web application. Now the problem, when the app directs to the new page, the handset (in this case Nokia 6280) warns the user that the data is being sent to a different site. Now why is this occurring. The looks liek this ' Response.Redirect("newpage.a...

Should it be Response.Redirect("~/NextPage.aspx") or Response.Redirect("NextPage.aspx") ?
Hi all,For all references to pages and images that are in the same directory as the current ASPX page, is it necessary to use the "~/" prefix to the pages? Both seem to work, although at times when I upload my code to a shared hosting environment, having the "~/" causes the page to error out.Which one is correct and loads faster?Thanks.  There is a difference between the two. the "~/" means starting from the Application root. Let's say you have this file structure. approot/page1.aspx approot/subfolder/page1.aspx approot/subfolder/page2.aspx If I do Response.Redirect("page1.aspx") ...

Web resources about - Response.Redirect & Response.Write issues -

Responses to the Ebola virus epidemic in West Africa - Wikipedia, the free encyclopedia
Organizations from around the world have responded to help stop the ongoing Ebola virus epidemic in West Africa . In July 2014, the World Health ...

Class-action lawsuit filed in response to iPhone’s Error 53
... class-action lawsuit, we will definitely continue to follow the story and report back if it moves forward. Class-action lawsuit filed in response ...

"Will the G.O.P. Response to Antonin Scalia’s Death Hand the Election to the Democrats?"
... John Cassidy at The New Yorker , and you might wonder why the question doesn't work the other way too: Why not ask Will the Democratic Response ...

Adidas had a great response to the people upset by its Valentine's Instagram photo of a same-sex couple ...
... comments since it was posted. Sadly, some of them were homophobic in nature. But Adidas' social media team was ready with a sassy response: ...

During Times Of High Demand, Demand Response Saves Electricity
Originally published on EIA. Demand response in the electricity market involves the targeted reduction of electricity use during times of high ...

USWNT Players Association Files Withering Response To U.S. Soccer Lawsuit
U.S. Soccer’s lawsuit against the U.S. Women’s National Team Players Association seeks to answer a seemingly simple question: Do the two organizations ...

Mayim Bialik Flashes Piers Morgan in Response to Susan Sarandon's #CleavageGate
Mayim Bialik Flashes Piers Morgan in Response to Susan Sarandon's #CleavageGate

Elizabeth Warren Slams Financial Firms' Two-Faced Responses To DOL Fiduciary Rule
Financial firms like Lincoln National and Prudential have cried that the Department of Labor's proposed fiduciary rule would significantly impact ...

Kazuo Ishiguro Has a Brilliant Response to People Who Think Genre Fiction Doesn’t Matter
If a primary task of fiction is to explore the human experience—who we are and what we mean to each other—then the fantastic and unreal must ...

NBC to Jeb: Isn’t your response on Scalia replacement a cop-out?
... ignored. “It’s up to Mitch McConnell. That’s really not important to me,” Bush insisted. Today, after a number of people criticized that response, ...

Resources last updated: 2/16/2016 8:49:25 AM