Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
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..

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
 
Share this answer
 
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:
C#
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:
---------------------------------------
C#
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"];
      }
  }
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900