不要在ASP.net MVC MembershipProviders影响样式表的链接? [英] Do MembershipProviders in ASP.net MVC affect stylesheet links?

查看:146
本文介绍了不要在ASP.net MVC MembershipProviders影响样式表的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我改变了的MembershipProvider在我的ASP.net MVC的网站,现在登录页面样式表是不正确引用。下面是形式标签的副本在我的web.config如果可能的原因。它看起来相同,虽然通过与名称和超时属性之外一个新的项目所产生的之一。

 <身份验证模式=表格>
      <形式loginUrl =〜/帐号/登录NAME =。ADAuthCookie超时=10/>
< /认证>

当我现在访问的页面,对CSS的链接标签如下所示:

 <链接的href =../内容/的site.css的rel =stylesheet属性类型=文/ CSS/>

在它的的是这样的:

 <链接HREF =../../内容/的site.css的rel =stylesheet属性类型=文/ CSS/>


解决方案

感谢伊恩·奥克斯利法案。这个问题没有与ResolveClientUrl解决,虽然。

这不得不处理的web.config文件。我有code,它是这样的:

 <授权>
  <拒绝用户=? />
  <让用户=*/>
< /授权>

我在下面主要一个位置元素,并说,任何人都可以查看这些内容,它现在的作品。事实证明,像CSS文件中的文件是不可见的,直到前授权。这已经得到解决。

这是我加的:

 <位置路径=内容>
   <&的System.Web GT;
      <授权>
         <让用户=*/>
      < /授权>
   < /system.web>
< /地点>

I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated by a new project with the exception of the name and timeout attribute.

<authentication mode="Forms">
      <forms loginUrl="~/Account/Login" name=".ADAuthCookie" timeout="10" />
</authentication>

When I visit the page now, the link tag for the CSS looks like this:

<link href="../Content/Site.css" rel="stylesheet" type="text/css" />

When it should look like this:

<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />

解决方案

Thanks Ian Oxley. The problem wasn't solved with the ResolveClientUrl though.

It had to deal with the web.config file. I had code that looked like this:

<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>

I added a location element below the main one and said that anybody could view that content, and it works now. It turns out that files like the CSS file were not viewable until authorized before. That is now fixed.

This is what I added:

<location path="Content">
   <system.web>
      <authorization>
         <allow users="*" />
      </authorization>
   </system.web>
</location>

这篇关于不要在ASP.net MVC MembershipProviders影响样式表的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆