DCSIMG
ASP.NET - Doron's .NET Space

Browse by Tags

All Tags » ASP.NET (RSS)

Using UpdatePanel to Disable GridView View State

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...
Posted by dorony | 7 comment(s)
תגים:

Ajax Page Methods Will Always Have Session

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: [ WebMethod ( true )] 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 [WebMethod...
Posted by dorony | 4 comment(s)
תגים:,

InProc Cache or Session Are Bad for Your Health

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...
Posted by dorony | 2 comment(s)

Overcoming IE Bug with a Custom SessionIDManager

Internet Explorer 6 has the most annoying bug in the world . When you click a window.open 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...
Posted by dorony | 6 comment(s)
תגים:

Using ASP.NET MVC on IIS 5

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...
Posted by dorony | 21 comment(s)
תגים:,

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

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...
Posted by dorony | 4 comment(s)
תגים:

Careful with that FreeTextBox

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...
Posted by dorony | 6 comment(s)

Using Script# to learn ASP.NET Ajax

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...
Posted by dorony | with no comments
תגים:, ,

Why client-side validation is a lie

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...
Posted by dorony | 1 comment(s)

VS2005 Web Project: Assembly referencing issue

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...
Posted by dorony | with no comments
תגים:

ASP.NET Url Rewriting

ScottGu has posted a great article about Url Rewriting, which basically allows you to replace addresses such as www.mysite.com/games.aspx?gameid=HalfLife with www.mysite.com/games/HalfLife. He pretty much covers everything you would want to know on this very useful technique. And a bonus - a very interesting architecture discussion has developed at ayende's . Dig in.
Posted by dorony | 1 comment(s)
תגים:

ASP.NET 2.0 CodeBehind

I've always found the new CodeBehind model of ASP.NET 2.0 to be a bit confusing. What I like to do with confusing things that I want to remember and understand better, is to write them down. Here we go. Of the top of your head, which classes will be generated by ASP.NET for the following WebForm? <% @ Page Language = " C# " AutoEventWireup = " true " CodeFile = " Tester.aspx.cs " Inherits = " Tester " %> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML...
Posted by dorony | with no comments
תגים:

Using ASP.NET Cache in Non Web Applications

I'm a unit-testing newbie, but I'm trying to get into it (as I realized, one day, how scared I was to change working code someone else wrote a long time ago). Trying to test some of my code using NUnit failed completely, since that code tried to cache stuff, and the calls to HttpContext.Current.Cache threw a null reference exception. Well, silly me, of course that wouldn't work. There's no HttpContext when the unit test is running (it's not running in a web application), and therefore no Cache object...
Posted by dorony | with no comments
תגים:,