Taswar Bhatti
The synonyms of software simplicity
Category: aspmvc
ASP.NET-MVC

Here is a simple trick on how to disable browser cache in asp mvc application with an attribute. If you have a base controller just add this to your base and all your request would have Pragma No-Cache

Simply add this to your base controller, and you are done 🙂

ASP.NET-MVC

To enable https on asp.net mvc, one can use the [RequireHttps] attribute on the base controller if you are using a base controller

But what if you want to give an option to the installer or the client to enable it in web.config, the easy way to do it for asp mvc2 is to […]

browser testing

Thanks to everyone who came out for the Ottawa .Net Community talk yesterday on WatiN , SpecFlow, BDD, WebDriver, I had a blast. I would like to thank everyone who came out for the talk. Here is my presentation WatiN – Web Application Testing on Prezi You can find the code on github https://github.com/taswar/ODNC-WatiN-And-SpecFlow-Demo-Code Additional […]

jquery

Was coding some new functionality and though I would post this, so that others can find it helpful. Lets say you have a form that has a checkbox that will update the select dropdown box with different values, when the checkbox is clicked. Something like the UI below. Your html code might look like

[…]

serviceLocator

There are certainly many ways to stub out dependency, using constructor injection, etc etc. Here is one way to quickly stub out ServiceLocator rather than implementing ServiceLocatorStub. Lets say you have code that uses a helper and the dependency is not quite the responsibility of that object but its the sub object that uses it. […]

json

I found this weird error when I was testing a no trivial test case in my app and was not able to find out what was wrong with it. It appears like a Json error in my asp mvc app, although the stack really doesn’t help 🙂

Basically what is happening is Json does […]

ASP.NET-MVC

Here are some changes that affected my asp mvc update process, specifically ASP .NET MVC2 Changes: GetControllerInstance & DataAnnotationsModelBinder. By the way, there is a tool that does it for you and also a manual way . But once you have updated there are also 2 more changes that you may need if you are […]

sparkviewengine

So you want to use Spark View Engine: Highlight Table Alt Row. Here is how one highlights an alt row with spark, quite clean I tell you. Assuming you have a css that like below.

And in your template you will call it like this.

Note: How I am using personIndex. It basically […]

ASP.NET-MVC

So I was going through some code of codebettercanvas and found it interesting of Karl Seguin using Html Helper extension for his form tags, which has its elegance. e.g

Basically it calls an extension method called LinkTo with a generic controller and a lamda for calling its action, the extension method looks like

[…]

UA-4524639-2