Using LocalDB in ASP.NET MVC Application with EntityFramework 6


At times we resort to the use of LocalDB, which in definition is a light weight version of the SQL Server Express, which loads itself on demand (i.e., whenever the application tries to read data using SQLConnection or through EntityFramework etc.,).  The db itself can be created by right clicking on the App_Data folder and selecting Add->SQL Server database option from Visual Studio Solution Explorer.  Once created the .mdf file resides in the App_Data folder and can be accessed via the Server Explorer (which acts as the conduit) to perform mundane db operations such as create/alter table, open query window etc.,

When we employ EF as the ORM to access data, it doesnt work as straight forward as it does with SQL Server based backend options.  One common error that you may see is the below error (as given in the screenshot):

Continue reading

1,062 total views, 1 views today

DNX SDK version ‘dnx-clr-win-x86.1.0.0-beta5’ failed to install. Error when creating a new ASP.NET 5 in VS 2015

After you install VS 2015, when you try to create a new project, on certain machines/desktops you get the below error:

DNX SDK version ‘dnx-clr-win-x86.1.0.0-beta5’ failed to install. The solution will use DNX SDK version ‘dnx-clr-win-x86-1.0.0-beta5’ for this session

The issue is due to the non availability of the powershell 3.0 version in the respective desktop. To solve the error install the PowerShell 3.0 version by following the instructions in the below link:

http://blogs.technet.com/b/heyscriptingguy/archive/2013/06/02/weekend-scripter-install-powershell-3-0-on-windows-7.aspx

1,439 total views, 2 views today

Creating a sample ASP.NET MVC application for Web Performance Testing – Part 2

Introduction

In this blog let’s create a sample MVC web application to be used for load testing using the “Web and Performance Testing” project in Visual Studio. This step is not mandatory as you can very well use any website to record your test against (though I would advise trying against sites such as Google or Yahoo, which can sense such testing and perceive them as Denial of Service attacks, which in turn would lead to blacklisting of your outgoing IP and would force you to enter a CAPTCHA every time you try Google or Yahoo, then after).So, it’s better to create our own simple application which can be always extended to accommodate some of the advanced concepts which require mimicking real-world scenarios.

Continue reading

2,913 total views, 5 views today

Preventing CSRF attacks in ASP.NET Web API calls.

In spite of securing the assets of a web application using folder permissions and SSL for secure transmitting of data over the wire, ASP.NET MVC applications using Web API’s are very much vulnerable to CSRF (Cross Site Request Forgery) attacks that permits malicious code to inject data by invoking the Web API actions resulting in serious consequences.

Continue reading

2,639 total views, 2 views today