从URL中删除或隐藏QueryString [英] Remove or Hide QueryString from URL
问题描述
我使用了URL重写。通过这个我得到这样的URL
http://thetravelprice.com/tours-packages/singapore/singapore-malaysia-6n-7d_88
这里_88是查询我通过它显示数据库包的完整信息的字符串,但我希望看到像
的网址http://thetravelprice.com/tours-packages/singapore/singapore-malaysia-6n-7d
这里我可以用url隐藏请求查询字符串(_)也是。如果可能的话,那么如何......... ????请尽快给出答案
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
推荐答案
使用网址重写
使用ASP.NET重写URL [ ^ ]
http:// weblogs。 asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library /ms972974.aspx [ ^ ]
https ://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/ [ ^ ]
试试这个.... :)
use url rewriting
URL Rewriting with ASP.NET[^]
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx[^]
http://msdn.microsoft.com/en-us/library/ms972974.aspx[^]
https://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/[^]
try this ....:)
如果没有关于你想要的输出的进一步要求那么这是一个问题在我看来,有两行。请参阅:
If there are no further requirements about your desired output then it is a matter of 2 lines in my opinion.See how:
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.
在表单中使用POST而不是GET。
Use POST instead of GET in your forms.
这篇关于从URL中删除或隐藏QueryString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!