How do you login/authenticate a user with Asp.Net MVC5 RTM bits using AspNet.Identity?

So here’s what login will basically look like in RTM (code copied from the ASPNET Identity sample code): // // POST: /Account/Login [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task<ActionResult> Login(LoginViewModel model, string returnUrl) { if (ModelState.IsValid) { var user = await UserManager.FindAsync(model.UserName, model.Password); if (user != null) { await SignInAsync(user, model.RememberMe); return RedirectToLocal(returnUrl); } else { … Read more

Razor 2 to Razor 3 MVC 5

In your Web.config(-s) make sure assemblyBinding contains the proper version for the assembly System.Web.WebPages.Razor and System.Web.Mvc. <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″> <dependentAssembly> <assemblyIdentity name=”System.Web.WebPages.Razor” publicKeyToken=”31bf3856ad364e35″ /> <bindingRedirect oldVersion=”1.0.0.0-3.0.0.0″ newVersion=”3.0.0.0″/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name=”System.Web.Mvc” publicKeyToken=”31bf3856ad364e35″ /> <bindingRedirect oldVersion=”1.0.0.0-5.0.0.0″ newVersion=”5.0.0.0″ /> </dependentAssembly> </assemblyBinding> And make sure that razor sectionGroup in ConfigSections reference latest versions as well: <sectionGroup name=”system.web.webPages.razor” type=”System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, … Read more

font-awesome not working bundleconfig in MVC5

Try using CssRewriteUrlTransform when bundling: bundles.Add(new StyleBundle(“~/Content/css”).Include( “~/Content/bootstrap.css”, “~/Content/body.css”, “~/Content/site.css”, “~/Content/form.css” ).Include(“https://stackoverflow.com/questions/22700385/~/Content/font-awesome-4.0.3/css/font-awesome.css”, new CssRewriteUrlTransform()); This changes any urls for assets from within the css file to absolute urls so the bundling doesn’t mess up the relative path. Docs for CssRewriteUrlTransform

Encountered an unexpected error when attempting to resolve tag helper directive ‘@addTagHelper’

Here’s how I fixed the issue: First, reset the Visual Studio Component Cache by closing Visual Studio and deleting this folder: C:\Users\[Username]\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache And finally, check the web.config files and change: <appSettings> <add key=”webpages:Version” value=”2.0.0.0″ /> … </appSettings> to <appSettings> <add key=”webpages:Version” value=”3.0.0.0″ /> … </appSettings>

Razor actionlink autogenerating ?length=7 in URL?

The ActionLink override you are using matches to the (string linkText, string actionName, Object routeValues, Object htmlAttributes) override. So your “Profile” value is being passed to the routeValues parameter. The behavior of this function with respect to this parameter is to take all public properties on it and add it to the list of route … Read more

upgrading from MVC4 to MVC5

Found out what need to be done in Views\Web.config. Just copy & paste these sections over what you have: <configSections> <sectionGroup name=”system.web.webPages.razor” type=”System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″> <section name=”host” type=”System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ requirePermission=”false” /> <section name=”pages” type=”System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ requirePermission=”false” /> </sectionGroup> </configSections> <host factoryType=”System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ /> <pages … Read more

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