I have this on my web.config file:
我在我的web.config文件中有这个:
<authentication mode="Forms">
<forms loginUrl="login.aspx" defaultUrl="Venues.aspx" />
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>
I only want to allow authenticated users to my pages. The problem is, the first time that I go to the login page, I don't have any images or styles on my page. I think this is because I denied access to the .jpeg
and .css
files. I think I can solve this issue in IIS, but I'm just in Dev. I only have VS 2008 and no IIS.
我只想允许经过身份验证的用户访问我的网页。问题是,我第一次进入登录页面时,我的页面上没有任何图像或样式。我想这是因为我拒绝访问.jpeg和.css文件。我想我可以在IIS中解决这个问题,但我只是在Dev中。我只有VS 2008,没有IIS。
Is it possible for me to allow access to the imgs
dir for the anonymous user in the web.config?
我可以允许在web.config中访问匿名用户的imgs目录吗?
3 个解决方案
#1
17
You could allow certain directories (directly under <configuration>
):
您可以允许某些目录(直接在
<location path="images">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
Also you would probably need to include WebResource.axd
您可能还需要包含WebResource.axd
<location path="WebResource.axd">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
#2
2
I think this is a known bug in Visual Studio - when you're not using IIS, visual studio mistakenly blocks the CSS file on the login page.
我认为这是Visual Studio中的已知错误 - 当您不使用IIS时,visual studio会错误地阻止登录页面上的CSS文件。
See here:
blog post from tomtech999
请参阅:tomtech999的博客文章
It should be OK when you run in IIS.
在IIS中运行时应该没问题。
#3
0
Similarly, if you want Microsoft's ReportViewer control to work on your web page, you need to add this:
同样,如果您希望Microsoft的ReportViewer控件在您的网页上运行,则需要添加以下内容:
<location path="Reserved.ReportViewerWebControl.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
This was a problem for me while attempting to get the 2010 version of report viewer to work. (Fortunately, it only took 7 billion years to uncover the source of the problem.)
在尝试使2010版报表查看器工作时,这对我来说是一个问题。 (幸运的是,只花了70亿年才发现问题的根源。)
#1
17
You could allow certain directories (directly under <configuration>
):
您可以允许某些目录(直接在
<location path="images">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
Also you would probably need to include WebResource.axd
您可能还需要包含WebResource.axd
<location path="WebResource.axd">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
#2
2
I think this is a known bug in Visual Studio - when you're not using IIS, visual studio mistakenly blocks the CSS file on the login page.
我认为这是Visual Studio中的已知错误 - 当您不使用IIS时,visual studio会错误地阻止登录页面上的CSS文件。
See here:
blog post from tomtech999
请参阅:tomtech999的博客文章
It should be OK when you run in IIS.
在IIS中运行时应该没问题。
#3
0
Similarly, if you want Microsoft's ReportViewer control to work on your web page, you need to add this:
同样,如果您希望Microsoft的ReportViewer控件在您的网页上运行,则需要添加以下内容:
<location path="Reserved.ReportViewerWebControl.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
This was a problem for me while attempting to get the 2010 version of report viewer to work. (Fortunately, it only took 7 billion years to uncover the source of the problem.)
在尝试使2010版报表查看器工作时,这对我来说是一个问题。 (幸运的是,只花了70亿年才发现问题的根源。)