很多人都在问" 网址的最大长度是多少?" 但据我所知,没有人问这个问题:
URL路径中的段应该是安全的最大长度是多少?
我认为这个问题同样重要.
这个问题是一个普遍的问题,旨在尽可能多地支持开箱即用的系统.
在C#中,您可以从传入的请求中获取URL路径段列表,并安装了安全模块,该路径可以视为此路径中URL路径中的段的最大长度?
我在下面的页面上看到,超过260个字符的URL路径段可能会导致自定义ASP.NET模块出现问题:
在Web浏览器中,无论您访问哪个网站,都要键入URL段,这/是一个通常映射到主页的URL路径段.使用Internet Explorer,Chrome和Firefox是流行的浏览器,它们支持的URL路径段长度的最大长度是多少?
我可以从以下资源中看到,不同浏览器的URL路径的最大长度不同,并且该数字有时非常高:
但这是一条路径而不是路径段.
我也知道在重写路径时,底层文件系统路径长度发挥作用,我可以看到支持的球场图在*nix OS中大约255个字符.
其他注意事项包括数据库表中URL路径段的最大长度.例如,在MySQL中,varchar列最多可以包含255个字符,但是有这种情况,人们是在MySQL中的表中存储路径段还是在varchar列中存储完整URL的人?对于URL路径段,这是否意味着255个字符太长了?
是否有任何关于URL路径段的W3C规范,因为我无法发现任何内容?
我确实读过关于URI的W3C规范但是我没有发现任何有用的东西:
我很困惑,URL路径段的长度没有设定标准,所以也许我错过了什么?
我真的在寻找尽可能多的不同系统支持的信息,以及URL路径段的安全长度.
我有以下内容:
@model Pharma.ViewModels.SearchBoxViewModel
<div class="smart-search">
@using (Html.BeginForm("Index", "Search", FormMethod.Get, new { @class = "form-horizontal", role = "form" }))
{
<div class="form-group">
<div class="hidden-xs- col-sm-1 col-md-1 col-lg-1 text-right">
@Html.LabelFor(m => m.SearchPhrase, new { @class = "control-label" })
</div>
<div class="col-xs-8 col-sm-8 col-md-9 col-lg-10">
@Html.TextBoxFor(m => m.SearchPhrase, new { @class = "form-control" })
</div>
<div class="col-xs-4 col-sm-3 col-md-2 col-lg-1">
<input type="submit" value="Search" class="btn btn-default" />
</div>
</div>
}
</div>
Run Code Online (Sandbox Code Playgroud)
如您所见,这是创建一个输入元素.
传递给视图的视图模型包含以下内容:
public class SearchBoxViewModel
{
[Required]
[Display(Name = "Search")]
public string SearchPhrase …Run Code Online (Sandbox Code Playgroud) 最近我们遇到了一个问题,其中一个开发人员将代码行从使用HttpResponse.End改为使用HttpApplication.CompleteRequest时强制PDF以类似于以下方式下载:https:
//stackoverflow.com/a/8590579/3856039
这样做会导致某些PDF由于不间断的空间问题而无法下载,因此代码已更改回使用状态HttpResponse.End.
然而,在帮助我的同事进行一些研究时,我遇到了以下问题: Response.End()被认为是有害的吗?
链接到:https: //blogs.msdn.microsoft.com/aspnetue/2010/05/25/response-end-response-close-and-how-customer-feedback-helps-us-improve-msdn-documentation/
鉴于MSDN博客文章中记录的内容,听起来好像使用HttpResponse.End是错误的方法,所以我想知道它是否甚至需要或是否有更好的方法?
我很难在Visual Studio 2017中设置gulp.我不确定我哪里出错但是有一些我很困惑的事情我无法找到任何在线资源任何用途.
我正在使用的构建系统是CruiseControl.NET,我希望能够使用它.
这是我到目前为止所做的:
安装Visual Studio 2017 .NET Core cross-platform development并Node.js development选择(以及其他选项).
创建了一个新项目
gulpfile.js在项目中添加了一个文件
右键单击该文件并选择 Task Runner Explorer
在Task Runner Explorer中,我收到错误Failed to load. See output window (Ctl+Alt+O) for more information..
然后,如果我执行以下操作:
打开Node.js交互式窗口
运行命令 .npm install --global gulp-cli
关闭Visual Studio并再次打开它
在Task Runner Explorer中,然后我收到消息(No tasks found).
首先,这是在Visual Studio 2017中设置Gulp的正确方法吗?
我问这个的原因是因为我不确定为什么我需要用句点字符.npm作为前缀命令(即相反npm).
我也不确定gulp的安装位置,因为我无法在路径中找到它C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External\node_modules.
因此,我无法真正设置CruiseControl.NET.
我在Visual Studio 2017中使用Bower来安装Bootstrap和jQuery等软件包.
在我的观点中,我使用像这样的CDN引用相同的库:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.css"
asp-fallback-test-class="glyphicon"
asp-fallback-test-property="visibility"
asp-fallback-test-value="hidden" />
Run Code Online (Sandbox Code Playgroud)
如果我将Bower中的Bootstrap版本从3.3.7更改为其他版本,那么我必须记住进入Razor视图并将3.3.7更改为更新的版本号.
我应该使用Gulp来读取bower.json文件并使用正确的Boostrap版本号自动生成Razor视图,还是有更简单的方法来确保Bower和我的Razor文件保持同步?
我有一个问题,我使用相同的模板在页面上呈现一些内容,并使用相同的模板使用AJAX请求在页面上呈现其他内容.
以下代码呈现部分剃刀视图:
@model SearchBoxViewModel
<div class="smart-search">
@using (Html.BeginForm("Index", "Search", FormMethod.Get, new { @class = "form-horizontal", role = "form" }))
{
<div class="form-group">
<div class="hidden-xs col-sm-1 col-md-1 col-lg-1 text-right">
@Html.LabelFor(m => m.SearchPhrase, new { @class = "control-label heading" })
</div>
<div class="col-xs-8 col-md-9 col-lg-10">
@Html.TextBoxFor(m => m.SearchPhrase, new {@class = "form-control", placeholder = "for products, companies, or therapy areas"})
</div>
<div class="col-xs-4 col-sm-3 col-md-2 col-lg-1">
<input type="submit" value="Search" class="btn btn-default"/>
</div>
<div class="what-to-search hidden-11 col-sm-11 col-sm-offset-1">
<div class="checkbox">
<label>
@Html.CheckBoxFor(m => …Run Code Online (Sandbox Code Playgroud) 在安装WebActivatorEx nuget包后尝试访问页面时,我不断收到以下ArgumentException.
Server Error in '/PharmaDotnet/ux' Application.
The type Pharma.Mvc.Startup doesn't have a static method named Configuration
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The type Pharma.Mvc.Startup doesn't have a static method named Configuration
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin …Run Code Online (Sandbox Code Playgroud) c# ×4
razor ×3
asp.net ×2
.net-core ×1
ajax ×1
asp.net-mvc ×1
bower ×1
gulp ×1
http ×1
httpresponse ×1
node.js ×1
uri ×1
url ×1
webactivator ×1