![](/img/trans.png)
[英]why I can't use code files from app_code in my code asp.net c#
[英]ASP.NET C#: How can I call App_code functions inside of web.config
這是我在 web.config 中使用的代碼:
<add name="MainRule" virtualUrl="^~/Pages/([\w-_]+).html"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/page.aspx?pid=${PageTitleToId.ConvertPageTitleToPageId($1)}"
ignoreCase="true" />
在 App_Code 文件夾中,我有一個“PageTitleToId.cs”class,其中包含帶有字符串參數的 ConvertPageTitleToPageId function。
我是否遺漏了什么,因為在我運行頁面時未調用 ConvertPageTitleToPageId function。
任何幫助表示贊賞,
簡單代碼
您無法執行 web.config 中的代碼。 我會更新page.aspx
以處理title
查詢字符串參數,在該參數上它調用ConvertPageTitleToPageId()
來獲取您的pid
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.