C# .NET - get the url parameters in query strings

Asked By abinav shankar on 17-Feb-12 01:29 AM
Hi

I am trying on performing the URL rewriting and my requrirement is this
My actual url is http://test.sulekha.com/test/testing.aspx?cityurl= and my rewritten url is: http://test.sulekha.com/chennai-adyar
now when i use the rewritten url i have to get the output as follows:
Response.Write(“: City URL : “ + …
Response.Write(“: Location URL : “ + …
Response.Write(“: City Name : “ + …
Response.Write(“: Location Name : “ + …
Response.Write(“: Page Type : “ + …

pl help me with it
Somesh Yadav replied to abinav shankar on 17-Feb-12 01:31 AM

You don't need jQuery for that purpose you can use the pure JavaScript:

function getParameterByName(name)
{
  name
= name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
 
var regexS = "[\\?&]" + name + "=([^&#]*)";
 
var regex = new RegExp(regexS);
 
var results = regex.exec(window.location.search);
 
if(results == null)
   
return "";
 
else
   
return decodeURIComponent(results[1].replace(/\+/g, " "));
}