English 中文(简体)
网上表格和电子版: Hide ID, show name?
原标题:Web forms and URL rewriting: Hide ID, show name?

我正与欧洲空间法中心合作,并提出一些问题。 我想我这样说:

www.domain.com/product/myproduct

但是,我也希望能够检索该产品的识别资料,而不能查阅数据库。 我想到的是,我们有这样的一席之地:

www.domain.com/product/myproduct/1 

www.domain.com/product/1-myproduct

但是,如果我能够隐藏该身份证,那将更好。

因此,我如何最简单地这样做?

Currently my Global.asax has the following route:

routes.MapPageRoute("Produkt visning",
                        "legetoej/{Categoryname}/{SubCategoryname}/{ProductName}",
                        "~/SingleProduct.aspx");

当我找回名字时,我就象在SIngleProduct那样。 页: 1

object productRoute = Page.RouteData.Values["ProductName"];

        if (productRoute != null && !string.IsNullOrEmpty(productRoute.ToString()))
        {
// do stuff
}

If I very simple could just get the ID instead of name, it would be awesome.

a. 感谢大量多彩的主机;-

最佳回答

To hide the ID of the Product... take the ID and apply Encryption to it... something like DES or Triple DES, then apply Server.URLEncode method to the ID and then you can easlily hide the id.

当你打开时,你可以简单地接收加密的识别器并做服务器。 URLDecode and the decode the ID.

Anyways... why dont you pass the ID of the product as a get Parameter ? Something like... www.domain.com/product/myproduct?PID=#$$#12 , where the PID is encrypted and URL Encoded and then you can easily process it.

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签