Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
I have use URL Rewriting . By this I have get URL Like That
http://thetravelprice.com/tours-packages/singapore/singapore-malaysia-6n-7d_88
Here _88 is the query string by which i have show full information of package from database , but I want to see the url like
http://thetravelprice.com/tours-packages/singapore/singapore-malaysia-6n-7d
here I can hide the request query string from url with (_) also.Is it possible , If yes then how.........???? please give answer asap
Posted
Comments
Mehdy Moini 19-Sep-13 2:22am    
you can encode the url in client and decode on your source
check the link:
http://www.w3schools.com/jsref/jsref_decodeuricomponent.asp
there are many components you can use

 
Share this answer
 
Comments
Lovely Bhatia 19-Sep-13 2:43am    
I HAVE ALREADY USE USE REWRITING BUT IN THIS I DON'T UNDERSTAND HOW DID HIDE QUERY STRING FORM URL WHICH IS SHOW WITH (_) IN MY URL AS U SEE IN ABOVE
Dholakiya Ankit 19-Sep-13 2:47am    
Then how can i read your monitor put some code you will not find ans untill you give a whole details
If there are no further requirements about your desired output then it is a matter of 2 lines in my opinion.See how:
C#
String url = "http://thetravelprice.com/tours-packages/singapore/singapore-malaysia-6n-7d_88";
String[] removeQryString = url.Split('_');
Console.WriteLine(removeQryString[0]); // this gives me output as you want,use removeQryString[0] anywhere what you want.
 
Share this answer
 
Comments
Lovely Bhatia 19-Sep-13 2:55am    
ITS SEEMS PERFACT.... NOW PLEASE ONE THING ALSO EXPLAIN ME ...HOW CAN WE REPLACE IT FROM URL BAR
ridoy 19-Sep-13 2:59am    
for that i need to see your code that you used to show address in a url bar.
Lovely Bhatia 19-Sep-13 3:03am    
FROM PAGE HTTP://THETRAVELPRICE.COM/SINGAPORE-TOUR-PACKAGES.ASPX.CS
WE SEND LIKE
public static string GenerateURL(object strname, object Title, object strId)
{
string strTitle = Title.ToString();

#region Generate SEO Friendly URL based on Title
//Trim Start and End Spaces.
strTitle = strTitle.Trim();

//Trim "-" Hyphen
strTitle = strTitle.Trim('-');

strTitle = strTitle.ToLower();
char[] chars = @"$%#@!*?;:~`+=()[]{}|\'<>,/^&"".".ToCharArray();
strTitle = strTitle.Replace("c#", "C-Sharp");
strTitle = strTitle.Replace("vb.net", "VB-Net");
strTitle = strTitle.Replace("asp.net", "Asp-Net");

//Replace . with - hyphen
strTitle = strTitle.Replace(".", "-");

//Replace Special-Characters
for (int i = 0; i < chars.Length; i++)
{
string strChar = chars.GetValue(i).ToString();
if (strTitle.Contains(strChar))
{
strTitle = strTitle.Replace(strChar, string.Empty);
}
}

//Replace all spaces with one "-" hyphen
strTitle = strTitle.Replace(" ", "-");

//Replace multiple "-" hyphen with single "-" hyphen.
strTitle = strTitle.Replace("--", "-");
strTitle = strTitle.Replace("---", "-");
strTitle = strTitle.Replace("----", "-");
strTitle = strTitle.Replace("-----", "-");
strTitle = strTitle.Replace("----", "-");
strTitle = strTitle.Replace("---", "-");
strTitle = strTitle.Replace("--", "-");

//Run the code again...
//Trim Start and End Spaces.
strTitle = strTitle.Trim();

//Trim "-" Hyphen
strTitle = strTitle.Trim('-');
#endregion

//Append ID at the end of SEO Friendly URL
strTitle = "-" + strname + "/" + strTitle + "-" + strId;

return strTitle;
}


& FROM HTTP://THETRAVELPRICE.COM/SINGAPORE-TOUR-PACKAGES.ASPX (SOURCE PAGE)

NavigateUrl='<%#GenerateURL(DataBinder.Eval(Container.DataItem,"LinkName"),DataBinder.Eval(Container.DataItem,"PackageName"),DataBinder.Eval(Container.DataItem,"PackageId"))%>'
Lovely Bhatia 19-Sep-13 3:03am    
& ALSO WRITE SOME CODE ON WEBCONFIG FILE
ridoy 19-Sep-13 3:19am    
As i can't test your code in my environment so it is difficult to say exact solution,but one thing is, before returning strTitle(last line of GenerateURL method) process this string(i mean split it) as i mentioned above and then return it,possibly it will work.
Use POST instead of GET in your forms.
 
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