asp.net-mvc-5

Kendo : ComboBox in a grid - Sending additional data of selected combobox to combobox Read()

房东的猫 提交于 2019-12-18 09:19:32
问题 ASP.NET MVC5 I have a combobox in a grid (InLine Edit): columns.Bound(x=>x.AccountID).EditorTemplateName("MyTemplate") Where MyTemplate is in /Shared There are millions of Accounts. When I try to edit the combo box in a grid and choose a new value, the ID of the Account, not the name, appears. This is because of course the name of the account is not immediately present so in the Read().Data() of the ComboBox.Datasource I need to send additional data ; the AccountID. My ComboBox Template looks

ASP.NET MVC 5 (Visual Studio 2013 Preview) Change Login Url for [Authorize]

こ雲淡風輕ζ 提交于 2019-12-18 09:08:21
问题 Hey guys I started playing around with the ASP.NET MVC 5 preview and everything has been going fine so far (I can only recommend it). However, I wonder where I can set the Login-Url for the Built-In [Authorize] -Attribute. I've moved the AccountController to a an area, so the path to the Login action is no longer /Account/Login but MyArea/Account/Login , which is ignored by the [Authorize] -Attribute, which in turn means, that whenever one navigates to a controller or action with the

MVC5, WebAPI2 and Ninject Parameterless constructor error

*爱你&永不变心* 提交于 2019-12-18 08:55:51
问题 So I have the exact opposite problem as MVC5, Web API 2 and Ninject I have a new MVC5/WebAPI2 project, that has both "Controller"s and "ApiControllers". I'm using the latest unstable version of Ninject.Web.WebAPI with no code changes to NinjectDependencyResolve.cs and Ninject.WebCommom.cs (besides binding my dependency) the ApiController's constructor injection works. However, when I call a MVC Controller I get: No parameterless constructor defined for this object. 回答1: The issue is you need

MVC5 AntiForgeryToken Claims/“Sequence contains more than one element”

时光总嘲笑我的痴心妄想 提交于 2019-12-18 07:38:19
问题 Case: I have an MVC5 application (basically the MVC5 template with a scaffolded view) with the Google authentication method enabled. The application has been configured to accept email as user name and to store the claims assigned from Google like Surname, givenname, email, nameidentifier, etc, to the membership database (AspNetUserClaims). When I register and log in with a "local" user everything is fine. If I log in with a Google user its fine. If I log in with an account set up to have

Does ASP.NET Identity 2 use machinekey to hash the password?

大兔子大兔子 提交于 2019-12-18 07:10:33
问题 I have created an application in ASP.NET MVC 5. Now I need to deploy the application on the server. Will my existing passwords work in ASP.NET Identity 2 when I deploy? Or do I need to use the same machine key that I have in my client machine? 回答1: You do not need to set the machine key for passwords. The machine key is used for encryption/decryption (ViewState, Session, Cookies, etc.) not for hashing. If you are using multiple instances of the application (think Azure Cloud Service) then you

Visual Studio cannot resolve model, but Razor pages loads

旧时模样 提交于 2019-12-18 05:48:11
问题 I have an MVC 5 application, made from the empty template. I've added Microsoft.AspNet.Mvc via Nuget and my packages file looks like so: <packages> <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net46" /> <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net46" /> <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net46" /> <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net46" />

Store Procedure not return value in MVC5

穿精又带淫゛_ 提交于 2019-12-18 05:25:11
问题 I am working in MVC5 with Entity Framework through db approach. I use Mysql as database. I create a procedure and when Call Procedure in Mysql it work as my expectation. But when i use procedure in MVC it return every time 0. Store Procedure CREATE PROCEDURE `checkSeasonAvailability`( IN paramSeasonId INT, IN paramHotelId INT, IN paramStartDate varchar(20), IN paramEndDate varchar(20) ) BEGIN DECLARE _startDate,_endDate DATETIME; DECLARE _hotelseasonID BIGINT(20); DECLARE _count,_rowCount,

Apply filtering to generate a dropdown list

跟風遠走 提交于 2019-12-18 05:23:18
问题 I have the following class and want to filter the dropdown list based on a certain condition. Model Classes public class Option { public int OptionID { get; set;} public string OptionName { get; set; } public int TechnicalCharacteristicID { get; set; } public int LsystemID { get; set; } public virtual ICollection<OptionValue> OptionValues { get; set; } public virtual TechnicalCharacteristic TechnicalCharacteristic { get; set; } public virtual Lsystem Lsystem { get; set; } } public class

Unable to access CreateAsync in User Manager

蹲街弑〆低调 提交于 2019-12-18 05:07:08
问题 I'm trying to use the new Asp.Net Identity system. I've searched this in asp.net site and able to find a tutorial here. I've created Register action and appropriate view for it. But Unable to code it further as I'm struck using User Manager in Identity System. To be precise, It's here. var result = await UserManager.CreateAsync(user, register.Password); The UserManager class throws an exception Using the generic type 'Microsoft.AspNet.Identity.UserManager<TUser,TKey>' requires 2 type

Can we personalize Session Timeout for Roles in ASP.NET MVC 5

丶灬走出姿态 提交于 2019-12-18 05:00:33
问题 The idea is to set different values of Session Timeout for different User Roles in ASP.NET MVC 5 and ASP.NET Identity. Is it possible to do? 回答1: Based on their role you could set the timeout, i.e. HttpContext.Current.Session.Timeout = 20; Going by your previous question you want to do this dynamically. You could store and update the times themselves in session and set for each role on OnActionExecuting of a base controller. if (User.IsInRole("Admin")) { filterContext.HttpContext.Session