Solved

Encoding URL

Posted on 2013-05-20
7
466 Views
Last Modified: 2013-05-21
If I want to pass a SQL WHERE clause as a URL parm, I need to encode all the parms, correct?  So, I'm using Server.UrlEncode(parms) prior to doing the Response.Redirect.  Now, on the other end when I want to extract the parms, I guess I need to decode first?  I can Server.UrlDecode.   But if I'm using HttpContext.Current.Request.QueryString to get the parm, how do I use both HttpContext.Current.Request.QueryString and Server.UrlDecode in combination?
0
Comment
Question by:HLRosenberger
  • 5
  • 2
7 Comments
 
LVL 29

Accepted Solution

by:
QPR earned 500 total points
ID: 39182743
Server.UrlEncode(HttpContext.Current.Request.QueryString(parms).ToString())
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39185478
do you mean:

Server.UrlDecode(HttpContext.Current.Request.QueryString(parms).ToString())
0
 
LVL 29

Expert Comment

by:QPR
ID: 39185489
Oops yes
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:HLRosenberger
ID: 39185535
I tried that.  it does not work.  I have this:

report_id = Server.UrlDecode(HttpContext.Current.Request.QueryString("report_id").ToString())

This part is nothing:

HttpContext.Current.Request.QueryString("report_id")

because it does not find the "report_id" because everything after the ? in the URL is encoded.  So, How do I extract parms from an encoded URL?  If not encoded, this works fine:

HttpContext.Current.Request.QueryString("report_id")
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39185551
I got it working.  Only the data is supposed to be encoded.  I was encoding everything after the ?.  

Thanks!
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39185553
I've requested that this question be closed as follows:

Accepted answer: 0 points for HLRosenberger's comment #a39185478

for the following reason:

thanks
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 39185554
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert datetime to time string 10 28
Help with error in Query 2 31
exporting html table data 4 27
VB.net Duplicating a table - primary key not created 3 31
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

840 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