小编gre*_*eay的帖子

为特定站点选择F12开发人员工具时,"Internet Explorer已停止工作"

Internet Explorer 11(最新)在打开开发人员工具时打开了"Internet Explorer已停止工作"的消息,并且我打开了我的站点.Chrome,Edge不会给出问题.

我网站中的所有功能都能正常运行.

这只适用于我的网站(内联网网站)

在此输入图像描述

当我调试它时,我得到了

iexplore.exe中0x5B514C32(mshtml.dll)的未处理异常:0xC00000FD:堆栈溢出(参数:0x00000001,0x06EC2FFC).

如何解决我的网站中的行为导致此行为?

我已经尝试重置Internet Explorer并禁用所有加载项,但因为问题与其他网站没有关系,我只能认为问题是在我的网站中的html/javascript中做某些特定的人.

internet-explorer

15
推荐指数
4
解决办法
9524
查看次数

如何在新的VS2013 Asp.net模板中禁用System.Security.Permissions.ReflectionPermission用法,以便它可以在共享主机上运行

我从默认的MVC模板创建了一个全新的Visual Studio 2013 ASp.net MVC应用程序.但是我收到错误消息请求类型'System.Security.Permissions.ReflectionPermission的权限失败.

是否可以关闭此反射权限,以便网站仍然有效?

这是我的web.config

<?xml version="1.0" encoding="utf-8"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=301880
    -->
    <configuration>
    <configSections>

      <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    </configSections>
    <connectionStrings>
      <add name="MyDb" connectionString="Data Source=x.x.com;Initial Catalog=x;User Id=x;Password=x;" providerName="System.Data.SqlClient" />
    </connectionStrings>
    <appSettings>
      <add key="webpages:Version" value="3.0.0.0" />
      <add key="webpages:Enabled" value="false" />
      <add key="ClientValidationEnabled" value="true" />
      <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    </appSettings>
    <system.web>
    <trust level="Full" /> …
Run Code Online (Sandbox Code Playgroud)

deployment reflection asp.net-4.5 owin visual-studio-2013

14
推荐指数
2
解决办法
3万
查看次数

如何在控制器内获取@ Url.Action值

我在用 ASP.net core

我可以在视图中使用Html操作

@Url.Action("GetOptions", "ControllerName", new { id="1"});
Run Code Online (Sandbox Code Playgroud)

但是我想在Controller中获取它的字符串值.

例如

string Url= Url.Action("GetOptions", "ControllerName", new { id="1"}).ToString();
Run Code Online (Sandbox Code Playgroud)

在以前版本的MVC中,您可以在控制器中引用辅助程序

  UrlHelper urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
Run Code Online (Sandbox Code Playgroud)

基本上我想要做的是在我的控制器中生成一个URL字符串表示

asp.net-core-mvc asp.net-core

11
推荐指数
1
解决办法
1万
查看次数

dnx:错误:无法加载应用程序或执行命令'ef'

我正在使用ASP.NET 5Beta 8和Entity Framework 7Beta 8

我创建了一个新的类库包.

我运行了以下安装包提示:

Install-Package EntityFramework.SqlServer -Pre
Install-Package EntityFramework.Commands -Pre
Install-Package Microsoft.AspNet.Identity.EntityFramework -Pre
Run Code Online (Sandbox Code Playgroud)

我的 project.json

{
 "version": "1.0.0-*",
 "description": "MARS Class Library",
 "authors": [ "myname" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "dnx451": { }
  },
  "dependencies": {
     "EntityFramework.Commands": "7.0.0-beta8",
     "EntityFramework.SqlServer": "7.0.0-beta8",
     "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta8",
  }
}
Run Code Online (Sandbox Code Playgroud)

在我的包管理器控制台中,我导航到我所在的src\project目录project.json并运行任何dnx ef命令,例如:

dnx ef migrations --help
Run Code Online (Sandbox Code Playgroud)

要么

 dnx ef migrations add InitialMigration
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

dnx:错误:无法加载应用程序或执行命令'ef'.

在行:1个字符:1

  • dnx …

entity-framework-core dnx asp.net-core

8
推荐指数
1
解决办法
1702
查看次数

如果浏览器是ASP.NET Core中的Internet Explorer,则检测服务器端

我正在尝试确定浏览器是否是服务器端ASP.NET Core中的Internet Explorer.

在我之前的cshtml中的ASP.NET 4版本中:

@if (Request.Browser.Browser == "IE")
{
    //show some content
}
Run Code Online (Sandbox Code Playgroud)

但在ASP.NET 5/ASP.NET Core intellisense Context.Request中没有选项Browser

我可以获得UserAgent,但这似乎相当复杂,因为IE有许多类型的字符串

Context.Request.Headers["User-Agent"]
Run Code Online (Sandbox Code Playgroud)

对于Internet Explorer 11.0,我得到了

 Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Run Code Online (Sandbox Code Playgroud)

这使得很难从中确定任何过去,现在或将来的IE版本.

asp.net-core-mvc asp.net-core

8
推荐指数
2
解决办法
6164
查看次数

C#警告中的冗余显式属性名称

我正在使用SimpleMembership提供程序并添加其他字段以在注册时保存.

要在注册时保存其他字段,我使用在任何地方使用的方法,例如Link

我使用我的HttpPost ActionResult Register方法中调用的以下SimpleMembership提供程序方法

WebSecurity.CreateUserAndAccount(registerModel.UserName, registerModel.Password,
    new { FirstName = registerModel.FirstName, LastName = registerModel.LastName, CompanyName = registerModel.CompanyName});
Run Code Online (Sandbox Code Playgroud)

其他字段由object类型的by值方法参数添加.对此的描述是"包含其他用户属性的字典"

这样可行.

我的问题是我安装了Jetbrains Resharper 8,对于属性名称,我得到了"冗余显式属性名称"警告.要删除警告,我更改我的代码将如下所示:

WebSecurity.CreateUserAndAccount(registerModel.UserName, registerModel.Password,
    new { registerModel.FirstName, registerModel.LastName, registerModel.CompanyName}); 
Run Code Online (Sandbox Code Playgroud)

我的问题是1)对于这个匿名对象参数,我现在删除属性名称,所以我不再得到Resharper警告,它是如何知道属性名称将用于匹配db属性类,因为它们被传递按价值?

2)具有或不具有属性名称的最佳实践是什么.没有它们是不是非常可读,并且在代码示例中它们被指定,所以我认为将它们放在更好的可读性而不是删除它

c# resharper

7
推荐指数
1
解决办法
3132
查看次数

JSON将JsonResult转换为javascript字符串而不编码引号

我需要使用转换Microsoft.AspNet.Mvc.Controller.JsonResult为字符串ASP.NET Core

这是我在ASP.NET MVC中的代码

public async Task<string> GetJsonData()
{
    //...
    var result = GetMyComplexObject();

    //using Newtonsoft.Json.JsonConvert method
    var jsonString = JsonConvert.SerializeObject(Json(result));
    return jsonString;
}

public async Task<IActionResult> Index()
{
    var myViewModel= new MyViewModel();
    myViewModel.JsonString = GetJsonData();
    return View(myViewModel);
}

public class MyViewModel
{
    //...
    public string JsonString { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

在我的cshtml中

var dataSet = {@(Model.JsonString))};
Run Code Online (Sandbox Code Playgroud)

但是,在生成的源中而不是引用的字段中,它们是html编码的,例如 &quot;field1&quot;

而不是运行字符串替换是没有更简洁的方法来转换JsonResultstring

c# json.net asp.net-core-mvc asp.net-core

5
推荐指数
1
解决办法
1万
查看次数

如何在ASP.NET Core中设置cookie validateInterval?

我正在尝试设置一个validateInterval使用的ASP.NET 5 RC1应用程序ASP.NET Identity 3

我正在尝试在这个答案中实现代码.

有很多代码示例像这样的答案,但似乎它在ASP.NET 5 RC1中无效

  app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            Provider = new CookieAuthenticationProvider
            {
                OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
        validateInterval: TimeSpan.FromMinutes(15)
            },
            ExpireTimeSpan = TimeSpan.FromMinutes(30)
        });
Run Code Online (Sandbox Code Playgroud)

如果我尝试使用上面的代码示例,ASP.NET 5 RC1我就不能这样做了

Provider不是CookieAuthenticationOptions Visual Studio 的属性,Visual Studio无法CookieAuthenticationProvider通过其灯泡选项找到任何命名空间.

如何设置validateIntervalASP.NET 5 RC1

asp.net-identity asp.net-core-mvc asp.net-identity-3 asp.net-core

5
推荐指数
2
解决办法
2078
查看次数