sybe
asked on
Request.QueryString as a String
In Asp.Net Request.QueryString is a collection with no default value.
Is there a simple way of getting the complete querystring as a string. Or do I have to parse my way through the complete Request.RawURL.
Is there a simple way of getting the complete querystring as a string. Or do I have to parse my way through the complete Request.RawURL.
ASKER
I do not want a collection. Querystring isn't always a collection.
myurl.aspx?1562892bhjkjhbn m
the querystring is not a collection of key/values. But it is a querystring. You can not iterate through that.
myurl.aspx?1562892bhjkjhbn
the querystring is not a collection of key/values. But it is a querystring. You can not iterate through that.
well if you just want the querystring as a string...just simply save it as a string....
You would due this by taking each param passed in the string...and saving them ..
then creating recombining the values as a string.
Is this what you mean? Or do you want the entire url that is passed
You would due this by taking each param passed in the string...and saving them ..
then creating recombining the values as a string.
Is this what you mean? Or do you want the entire url that is passed
ASKER
As I said, sometimes the querystring has no params, but is just a string. Concatenating key/values for a querystring without "=" will result is a querystring with "=" in your solution.
Anyway, I have created a function to parse it from Request.Rawurl.
Anyway, I have created a function to parse it from Request.Rawurl.
Public Function GetQueryString() As String
GetQueryString = ""
Dim sUrl As String = System.Web.HttpContext.Current.Request.RawUrl
Dim iQ As Integer = Instr(sUrl, "?")
If iQ > 0 Then GetQueryString = Right(sUrl, Len(sUrl) - iQ)
End Function
Here are some examples...it really is dependent of whats being passed and the format you are passing it..in terms of me coding this for you..but the concept is the same..
check this out.
http://www.asp-dev.com/main.asp?page=51
check this out.
http://www.asp-dev.com/main.asp?page=51
ASKER
But to add to this: I was looking for a single asp.net built-in variable. It is not that I am unable to code a querystring together from the pieces that asp.net gives me, but I was wondering if asp.net has a single built-in solution. I could not find one, so I asked.
Apparently there is none.
Apparently there is none.
ASKER
this works:
Response.Write(Request.Que
but this does not:
Dim sTest As String = Request.QueryString
dim sTest as String = <%=Request.QueryString %>
ASKER
That just gives a syntax error.
check this while im looking at something else....still not what your looking for 100%...
I guess my question is...why would you want a function that does this?
Every scenario I have dealt with you always have to parse the collection...as that is kind of the point...
does your scenario need know parse...
if not maybe we can just cast the collection
I guess my question is...why would you want a function that does this?
Every scenario I have dealt with you always have to parse the collection...as that is kind of the point...
does your scenario need know parse...
if not maybe we can just cast the collection
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Simply itterate throug each element of the querystring....concataning
Once the loop is finished you should have one lone string.
Hope this helps...