[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Response.Write with querystring?

Posted on 2012-03-14
5
Medium Priority
?
416 Views
Last Modified: 2012-03-14
Can someone please help me figure out why I can get this to work:

Response.Write("<script>window.open('CCNew.asp','_top');</script>")

but not this:

Response.Write("<script>window.open('CCNew.asp?proxyfor=' & Request.querystring('proxyfor') & '&mode=' & Request.QueryString('mode')','_top');</script>")

TIA,
Andrew
0
Comment
Question by:Ahelbling
  • 2
  • 2
5 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 37721770
Window.Open is interpreting this:
'CCNew.asp?proxyfor='


try Repsonse.Write
(String.Format("<script>window.open('CCnew.asp?proxyfor={0}&mode={1}_top</script>", Request.querystring("proxyfor"),  Request.QueryString("mode")))



the {0} . . . {1} . . . {n} get replaced with the extra parameters after the string in order.
0
 

Author Comment

by:Ahelbling
ID: 37721796
hmmm...

Response.Write(String.Format("<script>window.open('CCnew.asp?proxyfor={0}&mode={1}_top</script>", Request.querystring("proxyfor"),  Request.QueryString("mode")))

Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment: 'String'
0
 
LVL 41

Assisted Solution

by:Kyle Abrahams
Kyle Abrahams earned 800 total points
ID: 37721841
Response.Write(StringFormat("<script>window.open('CCnew.asp?proxyfor={0}&mode={1}_top')</script>", Request.querystring("proxyfor").ToString(),  Request.QueryString("mode").ToString()))

forgot to close the window.open . . . and added to String to the Request.QueryString parameters.


Also the query string is case sensitive.



Just saw this was ASP . . . thought it was vB.

add the following function (courtesy of http://www.codeproject.com/Articles/31432/String-Format-equivalent-for-ASP) and remove the "." from string.format.

Function StringFormat(sVal, aArgs)
Dim i
    For i=0 To UBound(aArgs)
        sVal = Replace(sVal,"{" & CStr(i) & "}",aArgs(i))
    Next
    StringFormat = sVal
End Function
0
 
LVL 18

Accepted Solution

by:
Rajar Ahmed earned 1200 total points
ID: 37721868
Response.Write("<script>window.open('currentPAge.aspx?proxyfor=" & Request.QueryString("proxyfor") & "&mode=" & Request.QueryString("mode") & "','_top');</script>")
0
 

Author Comment

by:Ahelbling
ID: 37721886
Thank you both!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

834 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