Tag | MVC Posts

ASP.NET SignalR is pretty new and very exciting feature in ASP.NET. You might want to play around with it and may encounter some hiccups during your implementation. This post will cover some issues that you may encounter and how to avoid it. If you have declared the following scripts in your View(.cshtml/.aspx) <script src="~/Scripts/jquery.signa... <script src="/signalr/hubs" type="text/javascript">&... <script type="text/javascript"> $(function ...
If you’re familiar with NetSqlAzMan or CanCan, you know that checking permissions based on a user’s activities is easier to manage and more flexible that working with the roles a user is in. Whatever method you take to add activity based authorization, if you are working in MVC you will run into the issue that AuthorizeAttribute only cares about Users and Roles. The good news is that you can inherit from AuthorizeAttribute and easily adapt it to account for activity-based authorization. If you didn’t ...
One of the things I always forgot to add to my web applications is the Robots.txt file that Search Engines use to see what they should index. This file and site maps help make your site easier to navigate by the bots and let them know what is legal and what you would rather not have the published in their engines. I typically add any administrative pages or account pages even though they are protected by security, no need for the login page to be index if they sniff the link. So how do you add Robots.txt ...
For the last decade, I have repeatedly, in my imitable Microsoft fan boy style, offered an alternative view to commonly held beliefs about Microsoft's stance on open source licensing. In earlier times, leading figures in Microsoft were very vocal in resisting the idea that commercial licensing is outmoded or morally reprehensible. Many people interpreted this as all-out corporate opposition to open source licensing. I never read it that way. It is true that I've met individual employees of Microsoft ...
We are almost done everything about the WCF transport extension over the message bus, which makes our services can be scaled out by introducing more instances over machines and servers. We had finished the structure of our transport extension and implemented the request reply mode in the 2nd post, the datagram and duplex mode in the 4th and 5th post. As I have said at the end of the 5th post, currently we can use our transport extension. But there still something left. Although are not that major ...
The ASP.NET MVC template drops a copy of Modernizr 1.7 in your project automatically, and if you check for NuGet updates the library is brought up to the current version - 2.5.3. The NuGet package is a a great way to introduce developers to Modernizr and makes checks for updates easy. But when adding Modernizr to your projects consider two alternatives: Alternative One – Content Delivery Network: Microsoft CDN currently hosts two Modernizr versions – 1.7 and 2.0.6. By using a CDN copy you increase ...
I recently deployed an MVC application to our production Windows 2003 Server and received an error that plagued me for longer then I care to admit. The error manifested when the Infragistics data grid attempted to render. The header would render, but the data area was empty and the waiting icon appeared and stayed.The script error associated with the problem is: The remote request to fetch data has failed: (parsererror) 'JSON' is undefinedIt turns out that the default compatibility settings in Internet ...
It is an oft-repeated maxim that you shouldn't add methods to a publically-released interface in an API. Recently, I was hit hard when this wasn't followed. As part of the work on ApplicationMetrics, I've been implementing auto-reporting of MVC action methods; whenever an action was called on a controller, ApplicationMetrics would automatically report it without the developer needing to add manual ReportEvent calls. Fortunately, MVC provides easy hook when a controller is created, letting me log ...
During the upgrade of a solution from the Web Api Preview 6 to MVC 4 Beta Web Api, I encountered a bug with a custom MediaTypeFormatter. In the Api controller I had a need to take the posted content object as well as some string identifiers/keys as parameters. The problem I encountered as that if I utilized a custom MediaTypeFormatter, these values came in as NullTake the following Api controller Post: // POST /api/values public HttpResponseMessage<Some... Post(string key, string id, SomeObject ...
After upgrading to the MVC 4 Web Api a problem came up where the custom MediaTypeFormatters we were using were no longer functioning.You must now override, CanWriteType and CanReadType in your customer formatter, or it will return false by default. 'Headers.ContentType' must be set before 'ObjectContent' can serialize its content"vIdeally, some checks would be made here to determine if you truly can read or write the type..but for this example, return true.Throwing the following error: /// <summary> ...
Single Page Application Frameworks are gaining popularity in the ever evolving web community with lot of libraries such as JavaScriptMVC, Backbonejs and many other libraries. ASP.NET MVC 4 introduces experimental support for building single page application (SPA) through a template. Much of the plumbing work of wiring up the client side scripts, javascript modelviews and the controllers is automated, making it a quick start to develop SPAs relatively easier. Lets examine a scenario where we are building ...
With modern frameworks available that were built with loose coupling and separation of concerns in mind, working in WinForms may seem like a testability wasteland. But there are times when the options of WPF with MVVM or MVC on the web are not available, and you’re stuck with WinForms. But fear not, the Mode-View-Presenter pattern is here to save the day! If you are not familiar with the MVP pattern, the idea is that you have a presenter, which handles all the interactions between the user and the ...
What is Model? A model can be considered as a container that facilitates presentation view, behavior and/or persisting data to/from data source (i.e. database etc). Besides the data container elements, a model may or may not contain behavior (i.e. logic), depending on design context of corresponding architecture. While the term “Model” is frequently discussed and used in Model-View-Controller pattern context, it is one of most important consideration in current world of software architecture. Download ...
Recommendation: Don't use the same action names for get and (Ajax) post.I am always amazed at how bad Microsoft's code examples are. Code generated using the default templates in Visual Studio is not much better. To find out, create an empty project (pick your favorite type) and run static code analysis or FxCop and see how many warnings you see. For some real fun try running StyleCop. The default templates (and therefore commonly-used standard practices) are also not very good in my opinion. Consider ...
I ran across a unique scenario recently, and I’m not sure if I should be proud of the solution, or appalled at the Frankenstein result. Either way, I thought I’d post about it to possibly help others in the same situation. I was developing a website leveraging jQuery / AJAX to query views of data at runtime. The kicker? I didn’t know which views. The choice of database view was determined via configuration and user choice. I was leveraging jqGrid for the client-side grid presentation, sorting, filtering, ...
Imagine this scenario: You are sitting in your final technical interview the lead architect asks you about your experience using the MVC pattern noted on your resume. Before you can answer the coworker who developed that application with you says “I can answer this one, if that’s OK.” The interview goes great and in two weeks you get the call and receive an offer for both of you. That’s one offer with given to a team of job applicants. You all accept together as one unit or agree to reject the offer ...
Nationwide search on dice.com

Feb. 4, 2012

C# - 8,518
ASP.NET  4,957
.NET MVC 1,101

Biztalk  409
Microsoft Dynamics CRM   461
Sharepoint 4,022
SQL Server 14,390


Java  16,854
groovy  292

Oracle 18,118

Monster.comNationwide searchJob Title: Empty ; Skills/keyword: mvc location: emptyResults: 523 jobs nationwide (mostly java )Change to Skills/keyword ASP.NET MVCResults: 80 jobs nationwide.net mvc = 129groovy = 66 jobsgrails = 44 jobsC# 3,481VB.NET 855.NET >5,000ASP.NET 2,245Java > 5,000Delphi = 93VB = 2,559Visual Basic 2,604ORM - 150Hibernate - 851NHibernate - 53Linq = 162Entity Framework = 97fxcop = 5 jobsOracle = >5,000SQL Server = 4,148mysql = 1,431db2 = 699Nunit = 120JUnit = 422Selenium ...
ASP.NET MVC 3 Walkthroughs & Books 1. Intro to ASP.NET MVC 3 - Rick Anderson http://www.asp.net/mvc/tuto... 2. Building an MVC 3 App with Database First – Julie Lerman a. http://msdn.microsoft.com/e... 3. Walkthrough: Retrieving Entity Types with a Stored Procedure (Entity Data Model Tools a. http://msdn.microsoft.com/e... 4. Book – Wrox - Professional ASP.NET MVC 3 http://www.wrox.com/WileyCD... ...
I’ve been testing\evaluating ComponentOne’s Studio for ASP.NET Wijmo suite for an MVC 3 project and I’m quickly becoming a fan! This product has so many things going for it that I’m not sure where to start. I’m going to focus on the Wijmo components, but the suite also contains a set of controls for ASP.NET WebForms development. If the Webform controls are as good as the MVC controls, they’re worth a look. There are two versions of the Wijmo components. An open source version containing 30 widgets ...
One of the great things about 2012 is that I am not in our office nearly 100% of the time during business hours. This is the first time I have been able to work from our office this much in about 4 years. In fact, we have moved three times during that four years and I have only averaged about 10-25% of my time in the office. This means I can actually setup my desk for development instead of business related tasks only. That means THREE MONITORS! My first reaction after a week with this setup: I never ...
This is my first post in this new year and was thinking about a topic to write on. Lately I have been working on varied things that flexes the brain muscles and things which I haven't done before. So a lot of learning and some unlearning this new year. One of the big issue which most people faces is learning to learn!.So, today I will share my experience of how I go about learning a technology, a skill or anything you want. The first and foremost thing is the motivation. This thing is very personal ...
Time to rejuvenate the blog. Many things afoot in the world of developement.Of note,MVC 4 RC is coming out soon. Eh, I don't really see much new there. A couple of interesting additions but like I said... eh.Umbraco 5 RC2 was released. You can get it at http://umbraco.codeplex.com/. Umbraco is a very nice CMS that runs on top of ASP.Net, and version 5 has been signifigantly rewritten to run on the MVC framework. The existing Umbraco 4.7.1 is still a respectable CMS, and there's lots of community-built ...
In a previous posting, I discussed replacing the stock MVC serializer used for the JsonResult exposed when you use the controller method Json(..) instead of View. This was all find and dandy. But how – you may wonder – can I call actions that contain complex parameters? Do I need a special binder? Should I write my own? The answer is mostly "no". As Phil Hack blogged, the ASP.NET MVC framework already contains value providers that take care of that for you. All you need to do is ensure that your ...
For various reasons you may find that the default JsonResult returned by invoking the controller method such as return Json([data); Is unsuitable for the consumer. The main issue most often encountered is that this method uses the JsonResult which in turn uses the JavaScriptSerializer with no access to the JavaScriptTypeResolver. This means that you can provide that serializer a parameter specifying you own custom type resolver. Other issues, such as maximum recursion depth and maximum length and ...
This demo is a continuation of my previous article about "Creating a Simple Log-in Form". Basically in this post I'm going to demonstrate the basic on how to edit and update the form with ASP.NET MVC 3. Before you go any further, I'd suggest you to check out my previous article first about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" and "Creating a Simple Log-in Form". STEP 1: Creating the Model class Just for the simplicity of this demo, I'm just going to display the FirstName, LastName and ...
The typical way to check for whether anything has changed in the view when you’re navigating away from a page is to bind a method to the change event of each input and to set a flag if this has happened. This flag is then checked when leaving the page and a notification is shown to the user if the flag is raised. This is all good but it does not take into account things like changing the order of inputs and changing values back to their original values. Also, creating dynamic elements makes this ...
Today's $10 Deal of the day from Apress at http://www.apress.com/97814... is "Pro ASP.NET MVC 2 Framework" "In this book, you'll discover MVC's strengths and weaknesses for yourself—and put your best-learned theory into practice." If you are working at a site using MVC, then this is a very useful book ...
This demo is a continuation of my previous article about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" which I wrote few months ago. Basically in this post I'm going to demonstrate how to create a simple LogOn form in which users can supply their username and password. And how to authenticate and validate users in ASP.NET MVC 3. I will not elaborate more in details about the model, view and controllers function so before you go any further, I'd suggest you to check my previous article first about ...
I’ve heard people mention, a few times, how they would like for Microsoft to provide a blank template for ASP.NET MVC. The request seems strange because this is something that anyone can do themselves. This isn’t just creating an MVC project and deleting all the items, which I would agree is tedious. Rather, you can create a custom template of any type for reuse and sharing. This blog post shows how to create a custom project template, using the need for a blank MVC template as the use case. Creating ...
When Rob Conery left Microsoft I gave a blog retrospective on possible reasons behind his exit. Today I’m happy to reload the cannon and aim it square at the latest Microsoftie to hand in his blue badge – Phil Haack. Phil has been a huge part of why Microsoft MVC is a success, and his contributions have changed the way web development is done on the Microsoft platform. So why leave, and why leave to Github? Couldn’t he have just switched to the TFS team if he liked code repositories so much? Well, ...

I was recently made aware of a couple of people having issues with WCF services (or ASP.NET applications) when using the MVVM Light project template for Silverlight. There is a blog post and a StackOverflow question, so what exactly is happening there?

Read the rest of this entry »

This was a very interesting event, I had never spoken in an event with so many developers in one place. It was cool! I had two talks, one on HTML5 and IE9 where I demonstrated the HTML5 and CSS3 coverage in IE9 and performance improvements, the second on ASP.NET MVC Best Practices where I talked about a fraction of things that you need to be aware of and possibly use when you are developing an MVC application. The HTML5 and IE9 talk was more of a showcase and focused on new features that will continue ...
Using a simulated dialog window is a nice way to handle inline data editing. The jQuery UI has a UI widget for a dialog window that makes it easy to get up and running with it in your application. With the release of ASP.NET MVC 3, Microsoft included the jQuery UI scripts and files in the MVC 3 project templates for Visual Studio. With the release of the MVC 3 Tools Update, Microsoft implemented the inclusion of those with NuGet as packages. That means we can get up and running using the latest version ...
I've recently refactored the way Routes are declared in an ASP.NET MVC application I'm working on, and I wanted to share part of the system I came up with; a really easy way to declare and keep track of ASP.NET MVC Routes, which then allows you to find the name of the Route which has been selected for the current request. Traditional MVC Route Declaration Traditionally, ASP.NET MVC Routes are added to the application's RouteCollection using overloads of the RouteCollection.MapRoute() method; for ...
I presented sessions on MVC .Net and webmatrix. I covered stuff like what’s new in MVC .net and the architecture goodness of MVC pattern. I also demonstrated how MVC 3 / MVC 4 harness HTML 5 / mobile along with Jquery and Modernizr. PHP coding using MVC and Webmatrix and other advanced stuff like hosting PHP on windows or porting MYSQL Db to MSSQL is also is also part of the demo in the sessions. The slide decks are available at below link and all the demo is recorded and also shared at below link. ...
Was working @ home and then arrived nice and early on Monday armed with all this good stuff I did on the weekend. Login,Headphones On, Check Mail and make cup of tea. Goto load up Solution I was working on the weekend@ home What the !!!... If you edit the unloaded Project you will find something like this For some Murphys rule reason even after hitting VS2010 with SP 1 my work box has lost MVC3 so thats why {E53F8FEA-EAE0-44A6-8774-FF... is unknown This site has a list of the VS system guids ...
These are some of the best RSS feeds I've found for keeping up with HTML5. I'm doing jQuery & MVC development as well so you will find the links have a jQuery/MS angle to them. WhenCanIUse The oh-so-necessary caniuse.com, in RSS update format: http://feeds.feedburner.com... ScriptJunkie http://services.social.micr... good HTML, JavaScript, CSS site hosted by MS Rachel Appel's blog http://rachelappel.com/rss?... ...
This is the 5th post in the series of HTML5 for ASP.NET Developers Support for HTML5 in Visual Studio 2010 has been quite good with Visual Studio Service Pack 1 However, HTML5 Boilerplate template has been one of the most popular HTML5 templates out in the internet. Now, there is one for your favorite ASP.NET Webforms as well as ASP.NET MVC 3 Projects (even for ASP.NET MVC 2). And its available in the most optimal place, i.e. NuGet. Lets see it in action. Let us fire up Visual Studio 2010 and create ...
Microsoft has just announced the Windows Azure SDK 1.6 and the Windows Azure Tools for Visual Studio 1.6. Now people can download the latest product through the WebPI. After you downloaded and installed the SDK you will find that The SDK 1.6 can be stayed side by side with the SDK 1.5, which means you can still using the 1.5 assemblies. But the Visual Studio Tools would be upgraded to 1.6. Different from the previous SDK, in this version it includes 4 components: Windows Azure Authoring Tools, Windows ...

Thanks to everyone who attending my session on MVC Scaffolding at the CMAP Code Camp this past weekend. PowerPoint and all code samples can be downloaded here.

One of the cool things about HTML5 is the ability to play audio/video files out of the box without the dependency on plugins. Earlier I had written about HTML5 Video and the fallback using Silverlight for non-supported scenarios Visual Studio 2010 SP1 has decent support for HTML5, in terms of intellisense, validation etc., But, one issue that is constantly faced when using the HTML5 Video tag in an ASP.NET Application (Web/MVC) built using Visual Studio is that, the videos doesn’t play when running ...

I have been working for months on converting an ASP classic app to MVC 3. This new version needs to run on FF and Ipad Safari.

one of the things we found was the user of just the Name attribute for controls such as input and so forth. This works fine in IE and some other browsers. But Safari chokes on this. The solution is to make the Name and the ID the same and then all the browsers are happy.

In the past weeks I have discussed about the Preview ASP.NET MVC 4. So, now I will show another great features in ASP.NET MVC 4. After installing, you will have new ASP.NET MVC4 Web Application template when creating new project in VS.NET 2010. Once you click OK the following dialog box will appear If you have experience with ASP.NET MVC3, you will realize that the selected template int he previous screen, Mobile Application, wasn't there up to now. So, in ASP.NET MVC4 we have new Mobile Application ...
I am playing more with the Windows Developer Preview and simply love the backward compatibility it has for applications that used to work in Windows 7. And one of the applications critical to my day-to-day life is Visual Studio. Visual Studio 2010 with SP1 and ASP.NET MVC 3 Tools is my everyday requirement. Windows Developer Preview when installed from the MSDN Center has two flavors. One with the Developer Tools which I would assume, most of us developers would want and the other one, which is simply ...
Today the Microsoft announced that the In-Place Upgrade feature had had some improvements. The major one would be, now the user could be able to change the VM Size by In-Place Upgrade, without redeploying the whole service. What We Did Before Before this improvement, since the VM Size was defined in the CSDEF file, we have to redeploy the service to change the VM Size property. This means we would remove the existing roles and VMs and then ask the Windows Azure to reallocate the new VMs with the ...
If you are planning to deploy your application with SQL CE as your application backend then here are the steps you need to perform. If you’re planning to deploy your application with SQL Server, than please read this post, How to Deploy an ASP.NET MVC 3 App to Web Hosting with "\bin Deployment" I assume that you have your ASP.NET MVC 3 application ready to be deployed with SQL CE 4.0 and EF 4.1. But make sure you have add assembly and for SQL CE 4.0 using NuGet. I recommend you to use NuGet here ...
This would be the first in the series of posts I plan to do for HTML5 for ASP.NET Developers The first thing that everyone would have experienced is the HTML5 header tag. The regular header tag that Visual Studio creates for ASP.NET Webforms is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml... This would be the header tag present in the Master Page or the actual ASPX Page when you don’t inherit from a Master Page. Till HTML5 specifications ...
Today post will show you how to build an Ajax form with JQuery validate supporting (unobtrusive) client and server side validation using ASP.NET MVC 3. If you want to see an examples, you can visit this post about Ajax in ASP.NET MVC 3. To enable (unobtrusive) client side Ajax and validation support include the following JavaScript files (in Views/Shared/_Layout.cshtml): javascript" src="@Url.Content("~/Script... <script type="text/javascript" src="@Url.Content("~/Script... ...
I've made a list of programming books I've read, am reading and am going to read on the Bookshelved Wiki; would anyone care to recommend good books for a web-oriented, C# Agile programmer which I've not discovered or not considered?I've reproduced the list so far below for convenience :)Programming books on my 'to read' list Real World Functional Programming by Tomas PetricekCode Complete by Steve McConnellWorking Effectively With Legacy Code by Michael FeathersProgramming books being read at the ...