Need help with VBscript/ASP

Sphexi

Diamond Member
Feb 22, 2005
7,280
0
0
I have a script which receives a posted query string from another page, in that string is a field called pageContents, and the value is always url encoded HTML. It's basically a way of sending my script a redirect that I url decode and display to the browser (response.redirect) and push the browser to another page. It's a basic form with hidden fields and some javascript to submit it.

What I need to do is capture the value of one of those hidden fields. So, it's a hidden form field, url encoded, and stored within a query string I've received. I can parse out and url decode the string, but I'm not sure how to find the form field name, and then pull just the value from it.

Any ideas?
 

GilletteCat

Member
Dec 28, 2001
181
0
0
Ok, which page does what? The scenario is not very clear, at least to me. If I understood you correctly, there is a page which submits via method GET, that is why you have the querystring to begin with and that form is url encoded. The page that receives the submit does not have any front-end and only processes the contents of the querystring to know where to redirect the browser from that point, which is stored in one of variables within the querystring and another variable, within the same querystring is something else you need to capture, do something with, prior to redirecting. Am I correct? I am not sure why you are having any problems. If you are able to request.querystring("redirectPath") why are you not able to do the same for any other variable within the querystring that you know the name of??? Please elaborate on your workflow a bit...
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
If your form field is

<input type="hidden" name="frmField1" value="abc">

You would access it with:

<%
Request.Form("frmField1")
%>
 

GilletteCat

Member
Dec 28, 2001
181
0
0
It sounds like the method is GET not POST on his form. That is the reason for the querystring as well as my response.
 

torpid

Lifer
Sep 14, 2003
11,631
11
76
Originally posted by: GilletteCat
Ok, which page does what? The scenario is not very clear, at least to me. If I understood you correctly, there is a page which submits via method GET, that is why you have the querystring to begin with and that form is url encoded. The page that receives the submit does not have any front-end and only processes the contents of the querystring to know where to redirect the browser from that point, which is stored in one of variables within the querystring and another variable, within the same querystring is something else you need to capture, do something with, prior to redirecting. Am I correct? I am not sure why you are having any problems. If you are able to request.querystring("redirectPath") why are you not able to do the same for any other variable within the querystring that you know the name of??? Please elaborate on your workflow a bit...

My interpretation is similar to yours, except that there is the addition that the querystring he's trying to query is URLencoded.

e.g.

This is what is in the user's address bar:

Process.asp?fromURL=%2fContent%2fBlog.asp%3fBlogID%3d123

So he wants to get one variable with this as a value: /content/blog.asp?BlogID=123

And another variable with this: 123 (the value of BlogID)
 

GilletteCat

Member
Dec 28, 2001
181
0
0
Originally posted by: torpid
Originally posted by: GilletteCat
Ok, which page does what? The scenario is not very clear, at least to me. If I understood you correctly, there is a page which submits via method GET, that is why you have the querystring to begin with and that form is url encoded. The page that receives the submit does not have any front-end and only processes the contents of the querystring to know where to redirect the browser from that point, which is stored in one of variables within the querystring and another variable, within the same querystring is something else you need to capture, do something with, prior to redirecting. Am I correct? I am not sure why you are having any problems. If you are able to request.querystring("redirectPath") why are you not able to do the same for any other variable within the querystring that you know the name of??? Please elaborate on your workflow a bit...

My interpretation is similar to yours, except that there is the addition that the querystring he's trying to query is URLencoded.

e.g.

This is what is in the user's address bar:

Process.asp?fromURL=%2fContent%2fBlog.asp%3fBlogID%3d123

So he wants to get one variable with this as a value: /content/blog.asp?BlogID=123

And another variable with this: 123 (the value of BlogID)

I thought that the values he wants to get are stored in the hidden fields on the same form where he gets the path from. Your example shows encoding for the path variable. And it is correct. URLEncode would not effect the whole querystring, only the values of the variables. That is why you are using "=" after the fromURL and %3d after BlogID. This means that BlogID is part of the value of the same variable. If BlogID was a value of a stand-alone hidden variable, only the value would get encoded, not the equal sign, nor the & between them. That's why I said that, encoded or not, he should simply be able to use request.querystring("variable name") to get a value of some variable from the hidden field and then apply urldecode to it: myVariable = server.urldecode(request.querystring("hidden_field_name"))