开发者

ASP.NET C#: How can I call App_code functions inside of web.config

This is the code I use in the web.config:

<add name开发者_如何学Python="MainRule" virtualUrl="^~/Pages/([\w-_]+).html"
  rewriteUrlParameter="ExcludeFromClientQueryString"
  destinationUrl="~/page.aspx?pid=${PageTitleToId.ConvertPageTitleToPageId($1)}"
  ignoreCase="true" />

In the App_Code folder I have a "PageTitleToId.cs" class which contains the ConvertPageTitleToPageId function which takes a string parameter.

Am I missing something because the ConvertPageTitleToPageId function is not called when I run the page.

Any help is appreciated,

Simplecode


You can't execute code in your web.config. I would update page.aspx to handle a title query string parameter on which it calls ConvertPageTitleToPageId() to get your pid.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜