ASP.NET MVC5/IIS Express unable to debug – Code Not Running

For me the solution was a much simpler one. In my Solution Explorer in Visual Studio, I right click on the web project, chose properties and then navigated to the “web” tab. From there I changed the Project URL to another port number. For example, if it was http://localhost:1052 – I changed it to http://localhost:4356. … Read more

mvc 5 SelectList from table with blank value for DropDownList

Use one of the overloads that accepts an optionLabel @Html.DropDownListFor(m => m.ID, (SelectList)ViewBag.MyList, “Please select”, new { @class = “form-control” }) or if you do not want to use the strongly typed methods @Html.DropDownList(“ID”, (SelectList)ViewBag.MyList, “Please select”, new { @class = “form-control” }) Which will add the first option with the text specified in the … Read more

“There was an error running the selected code generator” in VS 2013 scaffolding

VS2013 Error: There was an error running the selected code generator: ‘ A configuration for type ‘SolutionName.Model.SalesOrder’ has already been added …’ I had this problem while working through a Pluralsight Course “Parent-Child Data with EF, MVC, Knockout, Ajax, and Validation”. I was trying to add a New Scaffolded Item using the template MVC 5 … Read more

MVC5 (VS2012) Identity CreateIdentityAsync – Value cannot be null

I had the same error in the past but only when I created user with Entity Framework Migration Tool. When creating a user and signing withing the website, I had not error. My error was that I was not providing a SecurityStamp with migration. SecurityStamp = Guid.NewGuid().ToString() This property set, everything worked.

Does new ASP.NET MVC identity framework work without Entity Framework and SQL Server?

Not that simple. Not that hard either. You’ll have to write your custom implementation of: IUserStore<TUser> IUserPasswordStore<TUser> IUserTwoFactorStore<TUser> IUserClaimStore<TUser> IRoleStore<TRole> IUserSecurityStampStore<TUser, string> IUserRoleStore<TUser, string> UserManager<TUser> Then create your own user implementation, from IUser<TKey>, like: public class MyUser : IUser<string> { public string Id { get; set; } public string UserName { get; set; } } … Read more

Correct way to use HttpContext.Current.User with async await

As long as your web.config settings are correct, async/await works perfectly well with HttpContext.Current. I recommend setting httpRuntime targetFramework to 4.5 to remove all “quirks mode” behavior. Once that is done, plain async/await will work perfectly well. You’ll only run into problems if you’re doing work on another thread or if your await code is … Read more

Add Custom Claim Types

As I’ve checked your Code there are no problem in it. Here’s what I want you to do: Check if the cache was clear. If your cache was not cleared you can clear it like this: CTRL+SHIFT+DELETE It’s because during your login, it will save in cookies and it was not clear, and it happens … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)