如何隐藏ASP.Net MVC4中的Url参数? [英] How to hide Url parameter in ASP.Net MVC4 ?

查看:277
本文介绍了如何隐藏ASP.Net MVC4中的Url参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何隐藏ASP.Net MVC4中的Url参数?





我正在研究Asp .Net MVC。当我点击动作链接时,我导航到UserDetails.cshtml页面很好,但是网址是这样的



localhost:8080 // Admin / UserDetails / 5。



i不希望在URL中显示我想要的URL当我点击actionlink时会像这样



localhost:8080 // Admin / UserDetails /



任何建议??

解决方案

你无法隐藏url参数。如果您希望隐藏参数的原因是人们无法访问他们无权访问的ID,那么解决方案是修改您的代码,以便人们只访问他们有权访问的数据。

你不能隐藏这个参数。



使用POST而不是GET调用从url中删除参数。

你仍然会能够在请求消息中看到参数。



安全隐藏参数的唯一方法是加密它。


嗨Shiva

你必须实现URL Rooting Concept来隐藏你的URL参数。



请找到解决方案点击下面的链接。 />




http://www.dotnetcurry.com/aspnet-mvc/814/routing-aspnet-mvc [ ^ ]

How to hide Url parameter in ASP.Net MVC4 ?


I am working on Asp.Net MVC. when i click the action link i navigate to UserDetails.cshtml page that is fine but the Url is like this

localhost:8080//Admin/UserDetails/5.

i don't want to show the Id in URL i want URL when i click actionlink will be like this

localhost:8080//Admin/UserDetails/

any suggestions ??

解决方案

You can't hide url parameters. If the reason you want the parameter hidden is so that people can't access ids they are not authorised to, then the solution is to amend your code so that people only access data they are authorised to access.


You cannot hide this parameter.

Use POST instead of GET calls to remove parameters from url.
You will still be able to see the parameter in the request message.

The only way to safely hide the parameter is to encrypt it.


Hi Shiva
you have to implement URL Rooting Concept to hide your URL parameter.

Please find the solution to click link below.


http://www.dotnetcurry.com/aspnet-mvc/814/routing-aspnet-mvc[^]


这篇关于如何隐藏ASP.Net MVC4中的Url参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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