开发者

How to remove parameters from a URL on an ASP.NET site that uses URL Routing?

I recently added URL Routing to my non-MVC site that's based on ASP.NET and C#. So now if I get the following incoming request:

http://www.coolsite.com/item/27

...I can remap this behind the scenes to:

http://www.coolsite.com/widgets.aspx?id=27

Today, I added an additional parameter to the end of the URL to track the User who "Liked" this link on Facebook. I want to build a referral or flower type graph so I can track which users shared or liked something, and which of their friends followed the shared link. So, for user "Joe" who has an ID of 333, the URL looks like this if he "Likes" the page:

http://www.coolsite.com/item/27/333

The value "333" is important to me only when the page is being built on the server so I can update my FacebookLikeReferral DB table, but I开发者_如何学运维 don't really want (or need) to show the "333" parameter in the address box after the page has loaded.

What's the best practice way to modify the URL (via Routing or some other mechanism) to remove the "333" or "/333" from the end of the URL?


Return a Redirect result without that parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜