Posts tagged 'ASP.NET'

ASP.NET MVC. Like ASP.NET, but without the Voodoo!

Much has been written about Microsoft's new Model-View-Controller (MVC) framework for ASP.NET. The initial reaction of many developers - me included - is that Microsoft are driving us back to the bad old days of 'tag soup'; Server side code sits nestled amongst the HTML just like the traditional ASP pages we were all so glad to move away from.

When you delve a little deeper though, and learn more about the MVC pattern it really starts to make sense. Most of the code you'll write will be in the Controller classes, completely separate from your HTML. Yes, there is a little server side code in the HTML (the View), but if done properly this can really be kept to a minimum.

If you're having similar concerns, I'd urge you to consider how it would have been received if it had been released with the first version of .NET, before the event driven page framework was released. I suspect the answer to this question is that it would have been met with almost immediate and universal approval. It is so far removed from the really bad days of traditional ASP that most of us would have been singing its praises from the highest rooftops.

continue reading >
14 August

Automatically switching to SSL in ASP.NET

At first, it seems like quite a simple requirement - to automatically transfer a visitor to an SSL connection when they visit a certain area of our site (everything in the 'secure' folder in our case), and to transfer them back to a plain old HTTP connection when they leave.

Our initial implementation of this was a simple HTTP Module. This intercepted incoming HTTP requests for the '/secure/' folder and redirected the user to an HTTPS version of the same page. Conversely, if an HTTPS request comes in for a page which isn't in the '/secure/' folder, a redirect is issued to the HTTP version.

This appeared to work fine for quite a while. But - we started to have some problems with the release of IE8 and recent releases of Firefox. On visiting the site, it would appear that requests for WebResource.axd were still being issued over HTTP rather than HTTPS. This meant that our users started getting warning messages pointing out that some parts of the page were not being delivered securely.

continue reading >
1 August

Avoiding JavaScript and CSS Stylesheet Caching Problems in ASP.NET

We frequently run into problems related to caching when building ASP.NET websites. In particular, changes to CSS Stylesheets and JavaScript files on which the sites rely. After a new release our clients often have problems until they manually clear their browser cache. Some of our clients sit behind a proxy server which has its own cache, making the situation even worse.

The problem also extends to our development environment. As more of our UI work is moved into the browser through JavaScript and AJAX, we more frequently run into caching problems ourselves.

So - the solution we sought was to ensure caching when we wanted it, and to avoid it when we didn't!

continue reading >
30 July