首页 \ 问答 \ “失败渲染”Javascript文件和Css(“Fail Render” Javascript files and Css)

“失败渲染”Javascript文件和Css(“Fail Render” Javascript files and Css)

尝试加载一些JS和CSS文件时,我有一个奇怪的问题。

我有一个ASP.NET MVC Web项目,在其中我有Index.html并要求加载一些脚本文件。 我相信重要的是要提到我重写了Web.config的URL,而不是向我展示类似: localhost:2064/Index.html来显示localhost:2064/localhost:2064/Index/

我对我的脚本使用正常的“调用”,例如:

<link href="/Content/bootstrap.min.css" rel="stylesheet" />
<link href="/Content/Site.css" rel="stylesheet" />
<script src="Scripts/jquery-1.10.2.min.js" ></script>
<script src="Scripts/bootstrap.min.js" ></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/modernizr-2.6.2.js" ></script>
<script src="Scripts/Layout/menu.js" ></script>

但是,在控制台中我遇到了一些错误(Chrome Inspector Console):

Uncaught SyntaxError: Unexpected token < :2064/Scripts/jquery-1.10.2.min.js:1
Uncaught SyntaxError: Unexpected token < :2064/Scripts/bootstrap.min.js:1
Uncaught SyntaxError: Unexpected token < :2064/Scripts/bootstrap.js:1
Uncaught SyntaxError: Unexpected token < modernizr-2.6.2.js:1
Uncaught SyntaxError: Unexpected token < menu.js:1
Uncaught SyntaxError: Unexpected token < app.js:1
Uncaught SyntaxError: Unexpected token < indexController.js:1
Uncaught SyntaxError: Unexpected token < homeController.js:1
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.6/$injector/modulerr?p0=PBA&p1=Error%3A%20%…F1.2.6%2F%24injector%2Fnomod%3Fp0%3DPBA%0A%20%20%20%20at%20Error%20(native...<omitted>...4) MINERR_ASSET:22

当我查看这些文件的内容时,我得到以下信息:

状态: 304未修改

内容:与我的HTML文件相同(不符合预期)。

有帮助吗? 提前致谢。


I have a strange issue when trying to load some JS and CSS files.

I have an ASP.NET MVC Web Project and inside it I have Index.html and ask to load some script files. I believe it is important to mention that I rewrited the URL in Web.config so instead of showing me something like : localhost:2064/Index.html to show localhost:2064/ or localhost:2064/Index/.

I use the normal "call" for my scripts like:

<link href="/Content/bootstrap.min.css" rel="stylesheet" />
<link href="/Content/Site.css" rel="stylesheet" />
<script src="Scripts/jquery-1.10.2.min.js" ></script>
<script src="Scripts/bootstrap.min.js" ></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/modernizr-2.6.2.js" ></script>
<script src="Scripts/Layout/menu.js" ></script>

But, in console I get some errors (Chrome Inspector Console):

Uncaught SyntaxError: Unexpected token < :2064/Scripts/jquery-1.10.2.min.js:1
Uncaught SyntaxError: Unexpected token < :2064/Scripts/bootstrap.min.js:1
Uncaught SyntaxError: Unexpected token < :2064/Scripts/bootstrap.js:1
Uncaught SyntaxError: Unexpected token < modernizr-2.6.2.js:1
Uncaught SyntaxError: Unexpected token < menu.js:1
Uncaught SyntaxError: Unexpected token < app.js:1
Uncaught SyntaxError: Unexpected token < indexController.js:1
Uncaught SyntaxError: Unexpected token < homeController.js:1
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.6/$injector/modulerr?p0=PBA&p1=Error%3A%20%…F1.2.6%2F%24injector%2Fnomod%3Fp0%3DPBA%0A%20%20%20%20at%20Error%20(native...<omitted>...4) MINERR_ASSET:22

When I inspected to see the content of those files I get the following info:

STATUS: 304 Not Modified

CONTENT: Same as my HTML file (not as expected).

Any help? Thanks in advance.


原文:https://stackoverflow.com/questions/25176196
更新时间:2023-02-18 14:02

最满意答案

FIEO生活的一条重要规则。 过滤输入转义输出。

您从用户获取并存储的任何信息必须经过服务器端过滤,为此,您应该使用mysql_real_escape_string 。 在将值添加到数据库之前,它总是应该是最后一件事。 验证用户输入,确保它是你想要的,如果你需要使用正则表达式,检查它的长度和任何其他规则 - 删除任何符号或标签 - 完成所有这些,然后应用MySQL函数mysql_real_escape_string

然后,您在网页上显示的任何动态信息(即来自用户生成内容的数据库或直接来自用户输入的信息)都必须转义。 您必须对任何符号进行URL编码,移除(或编码)任何HTML标签。

我强烈建议你看专家Chris Shiflett关于网络安全的演讲:

http://www.slideshare.net/shiflett/evolution-of-web-security


An important rule to live by is FIEO. Filter Input Escape Output.

ANY information that you take and store from a user must be filtered server-side, in order to do this you should be using mysql_real_escape_string. It always should be the last thing you should before adding the value to the database. Validate the users input, ensure it is what you want, remove any symbols or tags if you need to using Regular Expressions, check its length and any other rules - do all this, then finally apply the MySQL function mysql_real_escape_string.

ANY information that you are displaying on your webpage that is dynamic - i.e. has come from a database of user-generated content or has directly come from user input must then be escaped. You must URL encode any symbols, remove (or encode) any HTML tags.

I highly recommend you watch this presentation on web security by expert Chris Shiflett:

http://www.slideshare.net/shiflett/evolution-of-web-security

相关问答

更多
  • FIEO生活的一条重要规则。 过滤输入转义输出。 您从用户获取并存储的任何信息必须经过服务器端过滤,为此,您应该使用mysql_real_escape_string 。 在将值添加到数据库之前,它总是应该是最后一件事。 验证用户输入,确保它是你想要的,如果你需要使用正则表达式,检查它的长度和任何其他规则 - 删除任何符号或标签 - 完成所有这些,然后应用MySQL函数mysql_real_escape_string 。 然后,您在网页上显示的任何动态信息(即来自用户生成内容的数据库或直接来自用户输入的信息) ...
  • 解决方案a) 使用htmlspecialchars的strip_tags,并将所需的标签列入白名单。 更好的解决方案 使用bbcodes,并为所需标签提供别名,例如:[b]粗体[/ b] solution a) use strip_tags insted of htmlspecialchars, and whitelist the needed tags. better solution b) Use bbcodes, and give aliases to the wanted tags, e.g: [b ...
  • 看一下OpenStreetMap wiki中的Nominatim文档 。 而不是使用简单的查询尝试结构化请求 : 此查询将返回名为Neustadt的所有类型的城市,城镇,村庄和郊区: http : //nominatim.openstreetmap.org/search.php?city = Neustadt 您还可以提供更多参数,例如国家: http ://nominatim.openstreetmap.org/search.php?city = Neustadt&country = Germany 请注 ...
  • 是的,使用它们几乎总是足够的。 但是,根据您执行的每个查询或您显示的每个页面内容,请记住,不那么特殊的字符也会导致意外。 简单地说, 如果你插入到mysql中,引用所有内容并且不要让字符串包含未处理的引号。 使用mysql_real_escape_string和他的朋友们。 如果你写入一个文件,那么你就是安全的 - 只记住你读回的内容。 如果您在输入字段中输入默认值,请注意您在“value”属性周围使用的相同引用。 恶意字符串将尝试关闭引号。 如果输出HTML,请使用html_special_chars以避 ...
  • 使用mb_detect_encoding函数来检测字符集。 这要求Mbstring扩展在PHP中处于活动状态,这在大多数服务器上都是如此。 Use the mb_detect_encoding function to detect the charset. This requires the Mbstring extension to be active in PHP, which it is on most servers.
  • 您是否想知道如何获取已发布值的输入? 您可以使用Input::get()方法。 $keyword = Input::get('keyword'); if(isset($keyword)){ $tournaments = Tournament::where('name', 'LIKE', "%$keyword%")->get(); }else{ $tournaments = Tournament::all(); } 还可以使用jQuery UI自动完成功能逐步搜索结果。 Are you wond ...
  • 使用PHP爆炸功能简单地分割您最近的输入 $module_fname = explode('-',$module_name)[0]; 接着 SELECT module_name FROM [tbl_module] WHERE module_name LIKE $module_fname.'%' Simply split your recent input with PHP explode function $module_fname = explode('-',$module_name)[0]; an ...
  • 对于ist问题: 在表单字段中使用空操作,因为您可以在单个文件中使用所有可用代码,例如:
    第二点: 您需要为匹配字符串添加%符号,例如: $result = mysqli_query($anslutning, "SELECT * FROM tblLogs WHERE category = 'trucking' AND author LIKE '%$filterName%'"); 边注: 如果您还想将类别用作表单字段,则可以使用隐藏表单输入作 ...
  • 而不是获取所有列并在条件时应用PHP,如果仅获取所需的列将更好。 试试这个查询: SHOW columns FROM users WHERE field NOT IN ('Name', 'ID', 'Password', 'Email', 'Company', 'Gender', 'Citizen') Instead of fetching all columns and applying PHP if condition, it will be better if you fetch only the ...
  • 是的,这是有道理的。 foreach ($users as $user) { $user_id = $user['user_id']; // At the end of the loop this is the last user $username = $user['username']; echo $user_id . ' ' . $username; echo ''; echo '

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)