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 Response.redirect, I was not able to make it pass the querystring or the session variables. How can I open in the same window and be able to pass variables?

Thanks in advance

0
mimitan
7/24/2008 9:52:01 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

9 Replies
1542 Views

Similar Articles

[PageSpeed] 49

Will this work?

 
Response.Redirect("http://10.10.30.25:8080/Orders/Orders.aspx?vloc=fac&vflag="&Session("varflag")&"&vid="&Session("FacilityID")&"&vrepid="&Session("varid"))
  
I never lose, some people are just better than me at winning.
0
AceCorban
7/24/2008 9:58:43 PM
Thanks for your reply but it did not work. it is blue underlined
0
mimitan
7/24/2008 10:13:55 PM

I'm confused, blue underlined?  Like a hyperlink?  How does response.redirect render a hyperlink?  You really shouldn't have to output a javscript execution to redirect if you want to do it from the server end.  Response.Redirect takes a string and goes to the url indicated in the string.  If you are capable of generating a string that has the right URL in it for a javascript code block being written to the page, you can use the same string in a Response.Redirect call...


I never lose, some people are just better than me at winning.
0
AceCorban
7/24/2008 10:26:47 PM

 Server.Transfer


Please Mark As Answer posts that helped you.

"If we learn from our mistakes, I should be brilliant by now."

0
nikki_doer_of_things
7/25/2008 1:25:43 AM

Use Server.Transfer instead to pass variables in another page..

http://www.c-sharpcorner.com/UploadFile/avi_sanjay/Server.Transfer.htm06172006162238PM/Server.Transfer.htm.aspx?ArticleID=f146b464-46fc-4d94-811b-a8057f4ca738

http://www.dotnetjunkies.com/WebLog/familjones/archive/2004/04/08/11020.aspx


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
7/25/2008 1:44:53 AM

use window.location instead of window.open. check this link

http://www.cheap-webdesigns.com/web-knowledge/javascript/javascript-window-location/

 


Sambeet
0
sambeetpatra
7/25/2008 2:37:31 AM

If you want to open a page as we did with respose.redirect use window.location function and for this you need to check out the java script tutorials, i suggest you to visit w3schools for simple tutorials.


ROAMER!

if (myReply.Equals(YourAnswer))
{
MarkThisThread = "Answerd";
}
0
ROAMER
7/25/2008 3:54:59 AM

Thanks for all your replies.

I read through the articles in the link you post. Since my pages are in different servers, as a result Server.Transfer was not a solution. But after reading the Server.Transfer articles, I am planing to use it in the future when the pages ar in the same server. It seems to be more efficient to do it this way.

I also tried the Window.Location but did not much luck. Perhaps my syntax was not right. I will keep testing.

I was able to use Response.Redirect to do what I needed. My syntax was wrong.

Thank you all.

0
mimitan
7/25/2008 4:55:54 PM

Ace,

Actually your line works. I just mistyped. Thanks

0
mimitan
7/25/2008 5:06:11 PM
Reply:

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

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

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

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

Won't let me use both Response.Write and Response.Redirect in same function?
Below is my code:Response.Write("&lt;script language='javascript'>window.open ('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...

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||Dub@i.net In what situation, would someone pass a true for the endResponse ...

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

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(); ...

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

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/vnd.ms-excel 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....

Problem with .net elements in vb.net Response.Write
I need to do a response.write on an aspx page in vb.net , 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>...

Web resources about - Response.write or Response.redirect? - asp.net.getting-started

Wikipedia:Redirect - Wikipedia, the free encyclopedia
This page documents an English Wikipedia editing guideline . It is a generally accepted standard that editors should attempt to follow, though ...

Asteroid Redirect Mission: Boulder Collection Concept - YouTube
This animation illustrates one of two robotic mission concepts under consideration for NASA's Asteroid Redirect Mission. In this concept, the ...

CloudFlare boss’s Gmail hacked in redirect attack on 4Chan
Content distribution network CloudFlare reset all its customer API keys over the weekend after its CEO’s personal and corporate Gmail was breached ...

Return to sender: is it really that hard to redirect your mail when you move?
Scrawling &quot;return to sender&quot; on past residents' mail is getting old, writes Meena Evers.

Parramatta shootings: We need to redouble our efforts to redirect all at-risk teens from a destructive ...
He was too young to drive, and too young to vote. We may discover why he killed, but we may not. What we can do is boost our efforts to divert ...

Budget 2015: Generic drug prices expected to fall as Government redirects health spending
Patients will benefit from a significant drop in the price of many common drugs with changes due in next week's budget.

Redirect 'spying,' ad funds to student jobs, Tories told
The federal government is highlighting its funding for student summer jobs at the same time it has come under fire from the opposition for the ...

Colorado governor candidate redirects volunteers to Douglas County races
KUSA-Republican gubernatorial candidate and current Colorado Secretary of State Scott Gessler is wading into a local school board election. ...

China’s ‘Great Cannon’ Uses DDoS Style Redirects for Censorship
... the great firewall works to block traffic by terminating links; it can’t alter the traffic, just stop it. The great cannon modifies and redirects ...

Apple - Redirect to Terms
Apple - Redirect to Terms

Resources last updated: 12/8/2015 12:01:25 PM