如何隐藏urlrouting查询字符串中的某些值? [英] How hide some values from urlrouting querystring?

查看:73
本文介绍了如何隐藏urlrouting查询字符串中的某些值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何隐藏UrlRouting查询字符串中的某些值?

我想在链接中只显示姓氏



我尝试了什么:



我有网址喜欢:

http:// localhost:6031 / Post / 2 / sarah / nelson





http:// localhost:6031 / Post / nelson

How hide some values from UrlRouting querystring?
I want to show only the family name in link

What I have tried:

I have urls like to:
http://localhost:6031/Post/2/sarah/nelson

to
http://localhost:6031/Post/nelson

推荐答案

假设2和Sarah与您无法执行此操作的页面相关。如果您的页面需要该数据并且它不在网址中,那么它怎么知道呢?如果您希望将这些值设置为默认值,则可以在路由中执行此操作,但不能使用路由来隐藏查询字符串值。
Assuming that "2" and "Sarah" are relevant to the page you can't do this. If your page needs that data and it isn't in the url then how can it know about it? If you want to have those values as defaults then you can do that in the routing, but you can't use routing to "hide" querystring values.


您可以使用Server.Transfer方法隐藏查询字符串。



Server.Transfer(http:// localhost:52009 / oms_trail / welcone.aspx?&vid =+ vendorid +&sid = + surveyid +&mcid =+ uniqeid +);
You can use Server.Transfer Method for hide Query String.

Server.Transfer("http://localhost:52009/oms_trail/welcone.aspx?&vid=" + vendorid + "&sid=" + surveyid + "&mcid=" + uniqeid + "");


这篇关于如何隐藏urlrouting查询字符串中的某些值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆