我刚刚构建了一个具有表单身份验证的应用程序。我无法在应用程序中看到我的风格(在成功登录后在页面上的Login.aspx NOR上进行身份验证之前(。当应用程序使用windows身份验证时,它们曾经是可访问的。
我读到另一个论坛说,在进行身份验证之前,你必须访问包含css的App_Themes文件夹,但请再次阅读上面的内容(在进行身份证明后,我也看不到它们(。这在以前使用Windows身份验证时是有效的。我带来了另一个菜单库,所以你现在会看到3个部分。
我使用的是Windows7。哦,我右键单击了包含我的网站文件的根文件夹。我在IIS 7中添加了IIS_IUSRS组和IIS APPPOOL[APP POOL NAME]的权限。我将所有权限都授予了两者。此外,我在我的站点中启用了基本身份验证和表单身份验证。其余部分已禁用。
感谢Stack Overflow精灵!!
==========================
web.config
Visual Studio中的Asp.Net配置选项。可以在中找到设置和注释的完整列表machine.config.comments通常位于\Windows\Microsoft.Net\Framework\v2.x\Config--><compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<!--<authentication mode="Forms">
<forms cookieless="UseCookies" slidingExpiration="true"
protection="All" timeout="60" loginUrl="~/Login.aspx">
</forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*"/>
</authorization>-->
<authentication mode="Forms">
<forms name="WANTA-AUTHENTICATE"
loginUrl="Login.aspx"
protection="All"
timeout="5"
path="/">
<credentials passwordFormat="MD5" />
</forms>
</authentication>
<authorization>
<allow users="*"/>
<deny users="?" />
</authorization>
<customErrors mode="Off" defaultRedirect="Default.aspx">
</customErrors>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState mode="InProc" timeout="55" />
<system.serviceModel>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" >
<baseAddressPrefixFilters>
<add prefix="http://localhost/" />
</baseAddressPrefixFilters>
</serviceHostingEnvironment>-->
<behaviors>
<endpointBehaviors>
<behavior name="AspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Wanta.Toolkit.WantaService" behaviorConfiguration="ServiceBehavior">
<endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" contract="Wanta.Toolkit.WantaService" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
===============
登录.aspx.cs
protected void Logon_Click(object sender, EventArgs e)
{
if ((UserEmail.Text == "x") &&
(UserPass.Text == "x"))
{
FormsAuthentication.RedirectFromLoginPage
(UserEmail.Text, Persist.Checked);
}
else
{
Msg.Text = "Invalid credentials. Please try again.";
}
}
将其添加到web.Config
文件的Configuration
部分下。它将允许匿名用户访问App_Themes
文件夹。
<location path="App_Themes">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
我会尝试在web.config中添加一个自定义位置,并允许使用*,看看它是否会选择样式。
过去,我总是记得通过右键单击我网站的根文件夹来访问我网站的文件,并访问以下内容:
服务器(又名位置(:本地机器IIS_IUSRS<===这是一个团体IIS APPPOOL[web_site_app_pool_name]
但由于某些原因,IUSR不在IIS_IUSRS组。我最终只允许IUSR用户访问我的网站,而不是群组。我了解到,通过转到"计算机">"管理">"管用户",您实际上可以将用户IUSR放入IIS_IUSRS组;组>。。。