CREATE DATABASE permission denied in database ‘master’ - SQL EXPRESS

Long back I wrote a post about Entity Framework Error – The underlying provider failed on Open. Yesterday some one told me, he is getting this error - CREATE DATABASE permission denied in database ‘master’, he is using an application pool with NETWORK SERVICE identity. Here is the solution, you...


How to set Bing wallpaper as your desktop wallpaper

This post is about setting Bing wallpaper as your desktop wallpaper using C# and Windows Forms. Bing.com is famous for having some nice pictures as wallpaper, updated on daily basis. The Bing Desktop application comes with same feature. Here is the code snippet, which has two parts one, download the...


How to upload file in ASP.Net MVC

This post is about upload file to server using ASP.Net MVC 4. First you need to modify the controller to accept the posted file along with the model. So you can modify it like this. [HttpPost] public ActionResult UploadImage(Student student, HttpPostedFileBase image) { var imageFile = Path.Combine(Server.MapPath("~/Images"), Path.GetFileName(image.FileName)); image.SaveAs(imageFile); return...


Problem with Internet Explorer and JSONResult in MVC

While working with the ASP.Net MVC project, one of my QA team member reported a strange issue, while uploading a file, Internet Explorer 9, showing a download file dialog like this. And the controller action is similar like this. [HttpPost, Authorize] public JsonResult Upload(FormCollection collection) { return Json("Uploaded successfully"); }...


How to integrate JQuery UI Datepicker in MVC

This post is about integrating JQuery UI DatePicker in MVC 4. First you need to modify the _layout.cshtml. Because by defualt, it won’t include required references for JQuery UI. You need to include both CSS and JS for JQuery UI references. So the modified _layout.cshtml will look like this. <!DOCTYPE...


Loading partial view on Ajax.Actionlink click

While working on an MVC project, I had to create few partial views and load them dynamically using Ajax. Here is the code snippet for the same. Controller method public ActionResult ShowMenu() { return PartialView("_SimpleMenu"); } In this I am returning the Partial View in the controller method. And here...


How to get code coverage in javascript

Long back I did some posts on getting code coverage in C#. And one of my previous posts was about implementing TDD in JavaScript. This post is about getting JavaScript code coverage. In computer science, code coverage is a measure used to describe the degree to which the source code...