Solved

ASP syntax

Posted on 2014-01-18
9
416 Views
Last Modified: 2014-01-18
I have a redirect in my page with passes parameters:

Response.Redirect "EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  

Works fine, I need to add one more parameter but I can't seem to get the syntax right.

The parameter name is:  NewUserid
and it comes from Request.Querystring("NewUserId")

I tried:

Response.Redirect "EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  & NewUserid=" & Request.Querystring("NewUserId")

But it gives me the following URL instead of the actual value:

http://localhost/bluedot/Intranet/Qnr/Qnrredirect.asp?NewUserId=Request.Querystring(
0
Comment
Question by:amucinobluedot
  • 4
  • 3
  • 2
9 Comments
 
LVL 58

Assisted Solution

by:Gary
Gary earned 300 total points
ID: 39791370
Response.Redirect "EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  & "&NewUserid=" & Request.Querystring("NewUserId")
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 200 total points
ID: 39791388
Like that ^^^
0
 

Author Comment

by:amucinobluedot
ID: 39791397
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 300 total points
ID: 39791407
Post exactly what you have now

Also you are using request.form and request.querystring - are you sure you have posted values and querystring vaues?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:amucinobluedot
ID: 39791418
Yes Sir.

This is the page that will post to the page that has the redirect:

http://localhost/bluedot/Intranet/Qnr/Indexexistingcontact.asp?NewUserId=22698

The one parameter that matters the most is "NewUserId" which is a querystring parameter and should be passed on to the next page.

This is the redirect:

Response.Redirect "EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  & "&NewUserid=" & Request.Querystring("NewUserId")

The next page gets:

http://localhost/bluedot/Intranet/Qnr/EmailQuestionnairexisting.asp?process=&draft=&NewUserid=Request.Querystring(

In this particular case I didn't pass either of the request.form parameters, thats OK, the NewUserid tho instead of passing the value passes:  Request.Querystring(

Not sure why the value is not being passed
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 300 total points
ID: 39791437
Well that's curious because it should not be happening at all.

Try

Response.Redirect ("EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  & "&NewUserid=" & Request.Querystring("NewUserId"))



If still the same then separate your redirect

myURL = "EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  & "&NewUserid=" & Request.Querystring("NewUserId")

Response.Redirect (myURL)
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 200 total points
ID: 39791439
Here are two demos that show how this should work.

The form page: "RRaspform.asp"
<%
dim submitr
submitr=Request.Form("submit")
If submitr <> "" Then
Response.Redirect "EmailQuestionnairexisting.asp?process=" & Request.Form("process") & "&draft=" & Request.Form("draft")  & "&NewUserid=" & Request.Querystring("NewUserId")  
End If
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>ASP Form Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form action="RRaspform.asp?NewUserId=12345" method="post">
Your name: <input type="text" name="fname" size="20" value="Dave" />
Process: <input type="text" name="process" size="20" value="slow" />
Draft: <input type="text" name="draft" size="20" value="beer" />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>

Open in new window


The redirect page:  "EmailQuestionnairexisting.asp"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>EmailQuestionnairexisting</title>
</head>
<body>
<h1>Response.Redirect Example</h1>
<% 
Response.write "EmailQuestionnairexisting.asp?process=" & Request.Querystring("process") & "&draft=" & Request.Querystring("draft")  & "&NewUserid=" & Request.Querystring("NewUserId")  

 %>
</body>
</html>

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 39791474
I decided to add the value to a hidden form element and then pass it on to the redirect page and .. well ..it worked.
0
 

Author Closing Comment

by:amucinobluedot
ID: 39791475
Thx
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Custom auto number 6 51
Select2 jquery help 9 45
Error viewing ASP page 12 94
Using VB6 to write Excel Spreadsheets - 5 18
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now