ASP.Net MVC
Please do me a favor and read this on my Gooroo site. (if I get enough hits, I get a payment) Thanks! I recently received the status report of a penetration test of my ASP.Net Core 1.0 MVC site done by our IT team. They used Rapid 7s vulnerability/penetration testing tool called Nexpose. I wish I had known about it before I thought I was “done” (I haven’t written code for it for a few weeks, it has been tested and is ready to deploy), but that’s a different story. I should be doing this testing as ......
One part of MVC Views that can cause problems is that the cshtml can cause run-time errors. This can lead to bugs in Production or found by QA that could be avoided if it was built when you build the project. Pre-compiling can be turned on to avoid those problems. You add this in the project file of your web application, by setting the <MvCBuildViews>true&l... in the .csproj. See http://www.dotnetcurry.com/... for more details. Another reason to pre-compile ......
I watched the very interesting talk by Steve Sanderson (KnockoutJs creator) from NDC 2016 yesterday and took some notes and screenshots that are worth sharing. Watch the video, but here is my summary. With Steve on the MVC team, there are a lot of helpful and timesaving features coming to MVC. He says MVC 6, but from the middleware and Mac he uses it has to be ASP .Net Core 1. I’m interested in the NodeServices, but I’m currently using Knockout and want to use Aurelia so it’d be good to see more ......
File new project, MVC (Visual Studio 2013 in April 2014) Update all NuGet packages and I get this: Server Error in '/' Application. Could not load file or assembly 'Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad36... or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)Description: An unhandled exception occurred during the execution of the current web request. Please ......
Reposted on my new blog. Come visit me there!A barrier to getting into writing executable tests (Unit Tests, integration tests, automated UI tests, etc) with some people I work with, is not knowing how to get started. I believe the desire and the recognition of the value and importance of this testing is growing, but I want to help people get over that hump. Read the MSDN Unit Testing MVC article. consider splitting controllers into a different project as suggested Don’t put your data access code ......
I recently had the following requirements in an MVC application: Given a new user that still has the default password When they first login Then the user must change their password and optionally provide contact information I found that I can override the OnActionExecuting method in a BaseController class.public class BaseController : Controller { [Inject] public ISessionManager SessionManager { get; set; } protected override void OnActionExecuting(ActionExe... filterContext) { // call ......
enable package restore on solution Nuget Ninject.MVC3 (pre-release available?) * adds Ninject, Ninject.Web.Common, Ninject.Web.Mvc * App_Start/NinjectWebCommon.cs -> has WebActivator.PreApplication... attribute -> runs at startup add interface and class for testing (IBikeManager and BikeManager) add controller constructor to HomeController that takes in the interface - run website => Error "Error activating IBikeManager No matching bindings are available, and the type is not self-bindable. ......
I can pass the name of the template to the controller like this (/Templates/KnockoutTemplat... where 'radial' is the name of a view (radial.cshtml), return a partial view of that name and have Knockout put it in the template block. My Controller: public class TemplatesController : Controller{ public TemplatesViewModel viewModel { get; set; } public ActionResult KnockoutTemplate(string templateName, int? id) { this.viewModel.Id = id; return PartialView(templateName.Re... ......
We upgraded a javascript library and pointed to the *.min.js files in our MVC4 application. They weren't getting downloaded and were not in the source code when running in debug="true", but worked in debug="false".
The lesson is to remove .min from your js files or the ScriptBundle doesn't return them for downloading.
bundles.Add(new ScriptBundle("~/bundles/x").Include(
"~/Scripts/x*"));
Turning the establishSecurityContext off (it’s on by default) was recommended in the IAC course on Pluralsight by Dominick Baier in the Security Best Practices module, State Management when making lots of short calls. “Other protocols like the WS 2007 Federation HttpBinding, they support state and unfortunately it’s turned on by default…. [uses] WS-Secure Conversation which is kind of heavy handed. It is quite complex as well and it has some performance implications.” ~ Pluralsight video http://www.code-magazine.co... ......
Full MVC Archive