【问题标题】:ASP.NET C#: How can I call App_code functions inside of web.configASP.NET C#:如何在 web.config 中调用 App_code 函数
【发布时间】:2011-07-19 01:38:23
【问题描述】:

这是我在 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 函数。

感谢您的帮助,

简单代码

【问题讨论】:

    标签: c# asp.net web-config global app-code


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      • 1970-01-01
      • 2010-10-04
      • 1970-01-01
      相关资源
      最近更新 更多