开发者

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

开发者 https://www.devze.com 2023-03-21 19:23 出处:网络
This is the code I use in the web.config: <add name开发者_如何学Python=\"MainRule\" virtualUrl=\"^~/Pages/([\\w-_]+).html\"

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

精彩评论

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