Using UpdatePanel to Disable GridView View State

Friday, May 23, 2008

View state. We usually hate it and love it at the same time. It's definitely a creature of comfort: having our controls automatically maintaining state is definitely a useful thing. But it can also be quite hazardous to your page performance - especially when used with a GridView that has many rows. This big-ass hidden field that gets generated is sure to make your users' round-trips quite a pain. And so the million dollar question is... How do I disable view state and stay alive? When you go ahead and mark that GridView of yours with EnableViewState="false"...

Ajax Page Methods Will Always Have Session

Tuesday, May 6, 2008

In my ongoing process of performance optimization, I noticed the use of an ASP.NET Ajax Page Method in a certain page. It looked something like this: public static bool HasDataBeenUpdated(DateTime lastUpdateTime) {    //Checks something in the cache against this date    //.... } Page methods are a way to Ajax-ly call a static method on the page, instead of creating a specific web-service for this. As you can see, this method was marked with . This property...
tags: ,

InProc Cache or Session Are Bad for Your Health

Tuesday, April 22, 2008

I've been doing a lot of performance tuning for our application lately, and the headline above is my number one tip for you. Unless you're writing a tiny application that will never ever have to scale, relying on the default ASP.NET Cache and Session modes - in process mode, that is - is a very bad idea. If you use in-process memory, you will get stuck without the ability to scale, that is move to a web-garden (more than one worker process on the same server) or a web-farm (more than one server serving requests for your app)....
one comment

Overcoming IE Bug with a Custom SessionIDManager

Friday, February 15, 2008

Internet Explorer 6 has the most annoying bug in the world. When you click a link in a modal dialog (opened by a call to window.showModalDialog), you sometimes lose the cookie, as the window is opened in a different process. Since that cookie usually contains your current session-id, the immediate result is that ASP.NET creates a new session for you, which rarely results in a positive outcome. The workaround suggested in the above linked kb-article did not work, and in this specific situation I couldn't change the modal dialog into a standard window, or to the neat...

Using ASP.NET MVC on IIS 5

Saturday, December 15, 2007

This is a small note for people trying to play with the MVC framework, and that are currently using Windows XP. If you dislike the ASP.NET development server that comes by default with Visual Studio as much as I do, you've switched your MVC application to work against IIS already. WinXP is running IIS 5, and you'll notice that the routing will stop working for you once you make that switch. For instance, a request for /Products/Categories, where Products is a controller and Categories is an action on the controller, will fail. The problem is that IIS never...
tags: ,

ASP.NET MVC Framework? Don’t Mind If I Do

Saturday, October 20, 2007

I'm spending the weekend at work (don't ask), so I had some time to read some articles and view some webcasts I left behind. I finally got to watching the entire lecture Scott Guthrie gave at the ALT.NET conference about the ASP.NET framework. You can check out the video here, and read about in Scott's blog, here. My initial impression of this was: Wow. This is so awesome. Finally ASP.NET is becoming a testable, maintainable platform. As I've mentioned, my team has recently entered TDD. The only thing that is incredibly hard to test in our architecture are...

Careful with that FreeTextBox

Monday, August 13, 2007

I came in need of an ASP.NET text box control that allows the user to enter rich text. Quickly enough I found FreeTextBox, an awesome control that is widely used in several well-known projects (such as Community Server, which hosts the blog you're currently reading). And, as it name suggests, the basic version of the control (which is more than enough for my needs) is free. So I started playing around with it a bit, throwing it in a web-page, editing some HTML and posting the page. Boom. ...A potentially dangerous Request.Form value was detected fromthe client... Well, of course. ASP.NET...

Using Script# to learn ASP.NET Ajax

Saturday, June 16, 2007

One of the really great things about the ASP.NET Ajax Extensions library is its client-side capabilities. It allows you to write OOP-Style code with namespaces, classes, inheritance and the works. Still, learning to use it can be a bit annoying. You don't get the intellisense or documentation support as you would with C#, and all in all the Visual Studio javascript editor is nothing to tell the kids about. Therefore, what I would have liked is to be able to write some code in C#, and see how it gets translated to javascript. Nikhil Kothari's Script# does exactly...
no comments

Why client-side validation is a lie

Saturday, May 26, 2007

You probably heard it a million times. It is one of the golden rules of web-development. Do not rely solely on client-side validation to ensure you get the data that you expect from the browser. Anyone can send you a crafted request that bypasses your script validation. Always validate on the server as well. And yet, I see a lot of commercial sites that ignore this rule, and it is easy as hell to break their logic. In fact, with the following simple steps I will show, you can bypass any javascript-only validation. Consider the following TestValidation.htm page: ...
no comments

VS2005 Web Project: Assembly referencing issue

Saturday, May 19, 2007

We have encountered an interesting issue regarding assembly referencing from an ASP.NET web project in Visual Studio 2005. A developer in my team did the following: he added to a web-site a reference to a GAC installed assembly, lets call it Gac.dll. This GAC installed assembly had a file reference to another assembly which was not installed at the GAC, we shall call it Lib.dll, and we shall assume it is located in c:\lib. Lets assume Gac.dll has the following code in it: namespace Gac { public class GacObject { ...
no comments