Visual Studio 2012 Express Forms应用程序 httpRuntime targetFramework =“4.5”
我刚刚通过NuGet添加了SecurePages模块。一切似乎都很好。我没有改变,但提供的SecurePagesConfig.cs无法引用该模块:
secureUrls.IgnoreUrl(@ “(*)的CSS。”);
错误1当前上下文中名称'secureUrls'不存在MyAppPath \ App_Start \ SecurePagesConfig.cs 20 13 MyApp
.dll位于我的bin文件夹中 对.dll的引用是存在的, 我看到NuGet中安装的软件包, 该引用将添加到web.config
中有什么想法吗? 感谢
SecurePagesConfig.cs:
using System.Web;
using System.Web.Mvc;
using SecurePages;
using SecurePages.Infrastructure;
using SecurePages.Entities;
using SecurePages.Services;
using System.Text.RegularExpressions;
using System;
[assembly: WebActivator.PostApplicationStartMethod(typeof(MyWebApp.App_Start.SecurePagesConfig), "Start")]
namespace MyWebApp.App_Start {
public static class SecurePagesConfig {
public static void Start() {
RegisterSecurePagesConfigurations();
}
public static void RegisterSecurePagesConfigurations() {
//Ignore defaults
secureUrls.IgnoreUrl(@"(.*)\.css");
secureUrls.IgnoreUrl(@"(.*)\.js");
secureUrls.IgnoreUrl(@"(.*)\.png");
secureUrls.IgnoreUrl(@"(.*)\.jpg");
secureUrls.IgnoreUrl(@"(.*)\.gif");
// Securing a collection of pages with Regex
//SecurePagesConfiguration.Urls.AddRegex(@"(.*)account", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);
//Securing a page by specifying its url
//SecurePagesConfiguration.Urls.Add("/cart");
//Registering a custom rule (Example for AppHarbor)
//SecurePagesConfiguration.RegisterCustomMatchRule(c => string.Equals(c.Request.Headers["X-Forwarded-Proto"], "https", StringComparison.InvariantCultureIgnoreCase));
//For testing only. By default, secure pages will ignore all request from localhost
#if DEBUG
SecurePagesConfiguration.IgnoreLocalRequests = false;
//Optional
//SecurePagesConfiguration.HttpRootUrl = "http://localhost:50535/";
//SecurePagesConfiguration.HttpsRootUrl = "https://localhost:44300/";
#endif
}
}
}