asp.net-mvc-5.1

How to include TypeScript files when publishing?

余生长醉 提交于 2019-11-28 20:24:46
I have an MVC 5.1 web application where I have recently started using TypeScript. I want to use sourcemapping, so I have included both the .ts, .js and .js.map-files in the project. When I publish the application (to e.g. file system or Azure), only the .js and .js.min files are copied, not the .ts-file. This means that I do not get source mapping on the published site. The TypeScript file has "Build Action": "TypeScriptCompile", and I have tested "Copy to Output Directory" both with "Do not copy" and "Copy always", still the .ts-file is not published. How can I include the .ts-files when

When performing post via ajax, Bad Request is returned instead of the JSON result

被刻印的时光 ゝ 提交于 2019-11-28 20:03:24
问题 Javascript jqXHR = $.ajax({ url: $frm.attr("action"), type: "POST", dataType: "json", cache: false, headers: headers, contentType: "application/json;charset=UTF-8", data: ko.mapping.toJSON(data, map), beforeSend: function(x) { if (x && x.overrideMimeType) { return x.overrideMimeType("application/json;charset=UTF-8"); } } }); jqXHR.fail(function(xhr, err, msg) { /* xhr.responseText NEED TO BE JSON!!! */ }); In Chrome Headers Request Method:POST Status Code:400 Bad Request Request Headersview

migration synch developmental and production databases

女生的网名这么多〃 提交于 2019-11-28 14:42:45
I am using MVC 5 with NET Framework 4.5.1. with Code-first. I am also using Migrations with the SQL 2012 server and (localdb)\v11.0. I am in the middle of developing a project using C# and MVC5. During development, I created a lot of new tables in my developmental computer and changed a the "Name" field which I believe the system makes an index for. I added it and deleted it several times. After that, I added a lot iof new unrelated tables, but for some reason, my migrations started giving me foreign constraint errors due to the indexes for the "Name" field. These errors kept multiplying as I

Mvc 5.1 MissingMethodException System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached

こ雲淡風輕ζ 提交于 2019-11-28 11:27:45
I'm update my MVC5 project to MVC5.1 and now have exception on route dictionary: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); stack trace: {"Method not found: 'System.Web.Routing.RouteValueDictionary System.Web.WebPages.TypeHelper.ObjectToDictionaryUncached(System.Object)'."} at System.Web.Mvc.RouteCollectionExtensions.CreateRouteValueDictionaryUncached(Object values) at System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url, Object constraints) at System.Web.Mvc.RouteCollectionExtensions.IgnoreRoute(RouteCollection routes, String url) at WebApplication1

No users have been created during Seed method using UserManager in ASP .NET MVC applications

十年热恋 提交于 2019-11-28 05:26:40
问题 When the Seed method runs, records/objects are added to my database. Every object is added as it should till I try add users to my application(at the bottom of Seed method). No one is added. Also there is lot of SQL exceptions thrown posted at the bottom. They are thrown even if Seed method is empty. How to add users to Entity Framework managed database? I created my code following Scott Allen's tutorial. protected override void Seed(WebApplication2.Models.ApplicationDbContext context) {

Identity 2.0 Reset password by Admin

孤街浪徒 提交于 2019-11-28 03:47:19
问题 How can I reset password as a admin for other users? I have tried using the code below var code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); var result = await UserManager.ResetPasswordAsync(user.Id, code, vm.NewPassword); when stepping through GeneratePasswordResetTokenAsync, the dispose method of the controller is called. Can someone please enlighten me? 回答1: You can also extend UserManager and expose an explicit AdminChangePassword API that doesn't require any information.

Overlap User Login in Two Projects with ASP.NET Identity

亡梦爱人 提交于 2019-11-27 18:49:38
问题 I have a problem I can not understand in asp.net identity apply the following steps create two empty web projects, they have names : WebApplication1 WebApplication2 install package " Microsoft ASP.NET Identity Samples 2.0.0-beta2 " On each project Create two sql database have the following names: WebDatabase1 WebDatabase2 add user has name " User1 " in WebApplication1 add user has name " User2 " in WebApplication2 run two the projects at the same time . My problem is when I Login by " User1 "

How can I fix assembly version conflicts with JSON.NET after updating NuGet package references in a new ASP.NET MVC 5 project?

久未见 提交于 2019-11-27 17:29:07
I created a new ASP.NET MVC 5 web project in VS 2013 (Update 1) then updated all NuGet packages. When I build the project, I get the following warning: warning MSB3243: No way to resolve conflict between "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". When I check the web.config, however, I see that a binding redirect is in place: <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> <bindingRedirect

Displaying DateTime picker instead of Date picker in ASP .NET MVC 5.1/HTML 5 specific

蓝咒 提交于 2019-11-27 15:47:27
问题 I write application in ASP .NET MVC 5.1 I have a field: [DisplayName("Date of Birth")] [DataType(DataType.Date)] public DateTime BirthDate { get; set; } and then in View <div class="form-group"> @Html.LabelFor(model => model.BirthDate, htmlAttributes: new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.BirthDate, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.BirthDate, "", new { @class = "text

How to include TypeScript files when publishing?

不打扰是莪最后的温柔 提交于 2019-11-27 12:55:17
问题 I have an MVC 5.1 web application where I have recently started using TypeScript. I want to use sourcemapping, so I have included both the .ts, .js and .js.map-files in the project. When I publish the application (to e.g. file system or Azure), only the .js and .js.min files are copied, not the .ts-file. This means that I do not get source mapping on the published site. The TypeScript file has "Build Action": "TypeScriptCompile", and I have tested "Copy to Output Directory" both with "Do not