Geeks With Blogs

News profile for Aligned at Stack Overflow, Q&A for professional and enthusiast programmers
"free in Christ Jesus from the law of sin and death." Romans 8:2 (ESV) Check out the Falling Plates video on YouTube.
more about the Gospel
And then listen to Francis Chan speaking at LifeLight in SD.

Donate Bitcoins

My Gooroo profile

Programming and Learning from SD MVC ASP.Net MVC
Avoid ClickJacking in ASP.Net Core 1.0
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 ......

Posted On Tuesday, July 26, 2016 2:41 PM

Pre-Compiling your MVC Views
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 for more details. Another reason to pre-compile ......

Posted On Tuesday, May 28, 2013 12:28 PM

Knockout Js and External MVC cshtml templates
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... ......

Posted On Friday, August 17, 2012 8:18 AM

Scripts not loading with ScriptBundles?
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(

Posted On Thursday, August 16, 2012 2:30 PM

Better single-page apps with ASP.NET MVC 6 - Steve Sanderson NDC2016
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 ......

Posted On Friday, March 4, 2016 5:31 PM

Updating New MVC Project NuGet packages could not load Microsoft.Owin.Security
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=, 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 ......

Posted On Sunday, April 12, 2015 2:01 AM

Quick Guide to setup a MVC project for Unit Testing
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 inside the Controller methods, use a data layer/object. ......

Posted On Thursday, September 25, 2014 9:18 PM

MVC OnActionExecuting to Redirect
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 ......

Posted On Tuesday, August 12, 2014 3:59 PM

Steps to Get MVC running with Ninject
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. ......

Posted On Wednesday, November 20, 2013 10:46 AM

When to set ws2007FederationHttpBinding establishSecurityContext to false
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 ......

Posted On Wednesday, June 12, 2013 11:26 AM

Copyright © Aligned | Powered by: | Join free