2011-07-19 49 views
0

内的app_code功能,这是我在web.config中使用的代码:ASP.NET C#:我怎么能说的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函数在我运行页面时没有被调用。

任何帮助表示赞赏,

Simplecode

回答

3

你不能在你的web.config执行代码。我会更新page.aspx以处理title查询字符串参数,它在其上调用ConvertPageTitleToPageId()以获取您的pid