表单身份验证后图像和CSS问题 [英] Images and CSS issue after forms authentication
问题描述
你好朋友,
我正在创建一个要在其中进行表单身份验证的应用程序.我需要显示一个带有登录链接的默认页面,普通用户可以看到该表单,而管理员可以登录并进行必要的更改.
但是,当我配置表单身份验证时,默认页面上的图像和CSS仅在有人登录时才起作用,否则它们不起作用.我也在使用母版页.
根目录上存在母版页,css文件夹和images文件夹.
请提出如何解决此问题的建议.
谢谢,
Jagjot
Hello Friends,
I am creating an application in which I am doing forms authentication. I need to show a default page with a login link, normal user can see the form and admin can login and make necessary changes.
But when I configure forms authentication the images and CSS on default page works only when someone logins, otherwise they didn''t work. I am using Master page also.
Master page, css folder and images folder exist on Root.
Please suggest how I can fix this issue.
Thanks,
Jagjot
推荐答案
在您的web.config中为CSS,图像文件夹添加
In your web.config add for css, images folder
<location path="css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
请参见此处 [
see here[^]
您需要在Web.Config授权标签上阅读.
此处:
授权元素(ASP.NET设置架构) [如何:控制ASP.NET应用程序中的授权权限 [ ASP.NET配置文件的格式 [
You need to read on Web.Config Authorization tag.
Here:
authorization Element (ASP.NET Settings Schema)[^]
HOW TO: Control Authorization Permissions in an ASP.NET Application[^]
Format of ASP.NET Configuration Files[^]
Sample:
<location path="css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
这将允许所有人访问登录页面,从而可以应用CSS.
This would allow everyone visiting the login page and thus CSS would be applied.
这篇关于表单身份验证后图像和CSS问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!