Click here to Skip to main content
12,355,050 members (39,052 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
I have to get a parameter from an encoded link .

The first format of link is like : About.aspx?parameter=bla

But because of a requirement the link is sended to the user like

About.aspx?parameter%3Dbla

From the link About.aspx?parameter%3Dbla , I should get the parameter(bla).
When I try to get parameter normally with
Request.QueryString["parameter"] or HttpContext.Current.Request["parameter"] , they returns null.

Thanks for the replies in advance..
Posted 4-Oct-12 4:50am
Comments
n.podbielski 4-Oct-12 11:12am
   
What are the keys of query string?
no_-_namee 4-Oct-12 12:45pm
   
I am working on a project to just see if it is possible to get parameter from the encoded link.On the solution , I am getting an input from textbox and send it to the link..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

What has happened is that the "=" in your querystring has gotten htmlencoded into %3D. You need to fix whatever is creating this url with querystring first so that it appears properly like About.aspx?parameter=bla
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Hi,its not a proper solution but it might help you,
just hold the encoded value in temp and then again decode it and use that query string value as you want to use:
public partial class About : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var myString = "parameter=\"bla\"";
        var base64EncodedString = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(myString));
        Response.Redirect("Default.aspx?temp=" + base64EncodedString);
    }
}
now code for Default.aspx.cs page:
---------------------------------------
public partial class _Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          var originalString = ASCIIEncoding.ASCII.GetString(Convert.FromBase64String(Request.QueryString["temps"]));
          lblShowName.Text = Request.QueryString["parameter"];
      }
  }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100