0

这是我在 web.config 中使用的代码:

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

在 App_Code 文件夹中,我有一个“PageTitleToId.cs”类,其中包含带有字符串参数的 ConvertPageTitleToPageId 函数。

我是否遗漏了什么,因为在我运行页面时未调用 ConvertPageTitleToPageId 函数。

任何帮助表示赞赏,

简单代码

4

1 回答 1

3

您无法在 web.config 中执行代码。我会更新page.aspx以处理title它调用的查询字符串参数ConvertPageTitleToPageId()来获取您的pid.

于 2011-07-19T01:44:47.047 回答