Just Sayin’ More Words

RSS Feed Subscribe

Less code is fun: ASP.NET 3.5 SP1 removes need for control adapter when using URL rewriting

If you use URL rewriting in your ASP.NET apps you’re probably familiar with the workarounds required to get your rewritten URL to show up in the action attribute of the form on your pages (see ScottGu’s ‘Handling ASP.NET PostBacks with URL Rewriting’). Well, no more.

Included in the latest ASP.NET Service Pack is this gem (via Scott Hanselman):

HtmlForm.Action is now settable - Again, subtle, but very cool.  I like to use URL rewriting a lot and want my <form action=”"> to be a certain way. Now I can set it manually without fooling around with RegEx’s and messing with the whole response.

Woot! I deleted my FormRewriter.cs control adapter and .browser file then added this little snippet to my common BasePage (you can do this in either Page_Init or Page_Load on individual pages) and now my form action attributes reflect the original URL.

// header is created by Ionic’s ISAPI Rewrite Filter (IIRF)
string u = Request.Headers["X-Rewrite-Url"];
if (!string.IsNullOrEmpty(u))
{
   
Form.Action = u;
}

Be sure to check out the rest of Hanselman’s post for more details on what’s new in SP1.

August 14th, 6:23 PM .NET, Tips Read more Comments

Great tool for finding SQL Injection vulnerabilities

I support a lot of large Classic ASP sites written years ago and every once in awhile they get hit with SQL Injection attacks. I grep through the log files, find out where they got in and patch it up and any other places where the same code is used. One site I’ve probably audited five times but it seems like I always miss a hole.

The HP Security Laboratory released a new piece of free (as in beer) software today called Scrawlr that scans your site and finds any openings. I ran it on a few of the sites I support and it found a couple more holes that when I looked at them, weren’t obvious injection points. The sites are all patched up now and I can sleep again.

June 24th, 5:40 PM SQL Server, Software Read more Comments

Disabling the AVG 8.0 Free LinkScanner

I use Grisoft’s AVG Free on my home computer for anti-virus. I’ve been using it for a few years and have been pleased with it. It doesn’t have a noticeable performance penalty and it generally stays out of the way. They’ve recently discontinued version 7.5 and have replaced it with 8.0, which is still available for free (although, they’re starting to be more discreet about that).

AVG 8.0 includes a new IE add-on called LinkHelper. When you do a Google search, it checks each link in the results and presents you with some icons indicating whether or not the site listed is safe.

2008-05-24_1820

This is great for my mom, but I don’t like to run any unnecessary browser add-ons. IE doesn’t need any help being more unstable. I figured I’d just disable it, but it’s not that straightforward. I went in and disabled it in the AVG options. This got rid of the icons in IE, but now AVG warns you via the tray icon that there’s an error. If I left it like this and there actually was an error, at a glance I wouldn’t know.

2008-05-24_1824

Disabling LinkScanner also does not unload the IE addon. So here’s my workaround. Enable LinkScanner in AVG, but then unload the browser addon manually:

2008-05-24_1833

AVG still thinks LinkScanner is loaded, but it’s not. You can now search the Googles uninterrupted.

Before anyone responds to this by saying "Switch to Firefox" let me preemptively respond to that. First off, I like Firefox just fine and have nothing against it. The reason I use primarily use IE is because the large majority of the people that use the web sites I build still use IE. If I don’t feel their pain, I find myself ignoring them. Using IE keeps me in touch with my users.

May 24th, 6:39 PM Software, Tips Read more Comments

Startup School

I’m headed to Silicon Valley this weekend for Startup School featuring Bezos, DHH, Buchheit, Graham, Andreessen, Arrington and many more. If you’re so inclined, you can follow my trip on Twitter.

April 17th, 8:32 PM Life Read more Comments

Internet Explorer 8 Beta 1 - First Impressions

It feels fast

I have no data to back this up, but everything feels snappier. Not just script performance but page rendering as well. Opening a new tab is still way too slow. It needs to be near instantaneous.

Bookmarks bar is improved

I’ve always been a big Links toolbar user keeping all my most frequently visited pages quickly accessible. The new Bookmarks bar takes the old Links bar and kicks it up a notch with WebSlices integration.

I never liked how IE7 took up valuable space on the tab strip for the favorites UI. Now that’s been moved to a more logical place on the Bookmarks bar.

Emulate IE 7 mode is handy

Finally a suitable solution to the perpetual issue of not being able to run two different versions of IE concurrently.

New features have potential to be very useful

WebSlices (basically chunks of a web page that you can quickly view from the Bookmarks bar) are neat and I can definitely see some potential uses (the eBay example from the MIX keynote today would definitely be one).

Activities has a lot of potential too although the right click context menu is getting to be a little crowded.

New developer tools are on the right track

They’re not quite FireBug yet, but they’re definitely a step in the right direction. What needs to happen to make it better? Make it exactly like FireBug!

Address bar text coloring is weird

IE8 highlights the current domain and dims the rest of the URL. Not sure that this is helpful for anything. I think this is going to bother the folks at site like ESPN:

2008-03-05_1543

Why the permanent horizontal scroll bar?

This is the only curious change I’ve seen and I’m hoping its a bug. The horizontal scroll bar is now permanently visible even when you can’t scroll side to side. I like having the permanent vertical bar to keep my layouts from jumping around but the permanent horizontal bar doesn’t solve any issues that I know of. I’d like to know the reasoning behind this.

Add-on manager is greatly improved

Extensions, search providers and activities are all managed from one place. It’s very well organized.

Few new options

A quick look through the Internet Options didn’t turn up anything that stands out. I’m shocked (and thankful) that most of what they’ve done appears to be under the hood (rendering, script perf, etc) with only a few new features. Let’s hope it stays this way until release.

March 5th, 5:03 PM Software Read more Comments

VS2005 ‘prop’ C# Code Snippet in VS2008

Automatic properties are nice, but sometimes you just want a good ol’ regular property with a backing field. Visual C# 2005 had the ‘prop’ code snippet which generated this:

visual c# 2005 prop code snippet

Visual C# 2008 now generates the following when using the ‘prop’ snippet:

2008-02-26_2330_001

I find myself wanting to use the old snippet more than the new one, so I went into the 2005 code snippets, copied the ‘prop’ snippet file, made a few changes and imported it into 2008 (Tools | Code Snippets Manager | Import).

Now, all is well:

Here’s a .zip file of the snippet that you can download.

February 27th, 1:16 AM .NET, Tips Read more Comments

Where is ‘Surround With’ for HTML?

Visual Studio feature request o’ the day: ‘Surround With’ in the HTML editor (highlight some HTML, hit Ctrl-K, Ctrl-S, type an HTML tag like ‘div’, press enter). Anyone know if this exists or not? How difficult would it be to write a VS add-in to make it happen?

February 23rd, 4:07 PM .NET, Software Read more Comments

It’s been awhile…

Lately (while not blogging) I’ve been thinking of things I’d really like to blog about but haven’t made the time for. Here they are:

jQuery
logo_jquery3 I hate JavaScript. jQuery changes everything though. I can actually be a functional JavaScript programmer. I particularly like how you can attach events without overloading your code with onclick="" everywhere. I got hooked on jQuery for UI bits (especially the tablesorter and tabs plugins), but I’m becoming obsessed with it because of the sweet Ajax functions. jQuery + ASP.NET AJAX PageMethods is teh awesome (minus the HUGE ASP.NET AJAX script handlers). I’ve also been pondering using jQuery for a light-weight faux-UpdatePanel setup (similar to this). You may hear more about this in the future.

SubSonic
subsonicsmall I can’t really add anything to the SubSonic conversation that you probably haven’t heard before so I’ll keep this section short. The unofficial MVC templates have made their way into a ton of my projects. I’m psyched for version 2.1 codename "Pakala" and the new, officially-supported Repository Pattern to replace the MVC templates.

Flee
I have an extremely fun project that’s heavily using Flee but unfortunately, that’s still under wraps for the time being.

Super Mario Galaxy
mario_galaxy_logo You can’t work all the time! This is the most fun I’ve ever had playing a game. I usually stick to sports games, but this game is incredible. It will redefine what you know about Mario and platformers.

Jing Project
jing-logo I can’t believe I hadn’t heard about this before today. I was looking for a way to more easily take screengrabs (without spending any money) when I came across TechSmith’s Jing Project. Jing is a dead simple way to share screengrabs and even simple screencasts. The interface is exceptional and the service works great from capture to uploading. Here’s hoping they keep it free!

MozyPro
Cheap, instant off-site back up. Takes the work out of backing up.

FogBugz On Demand Student and Startup Edition
FogBugz combines my favorite things: well-made software and free. Evidence-based scheduling help us keep the January 2008 update of SnapLeague mostly on time and the SVN integration works well and has come in handy many times.

February 6th, 9:30 PM .NET, Misc. Links, Software Read more Comments

If you like sports, and you like technology, then I have a blog for you.

I’ve started up a blog to cover the intersection of sports and technology called (wait for it, this is good) SportsTechBlog.com. I’ve been running this blog for awhile through The Press Box on my RIM Systems site but now I’ve decided to spin it off into its own site. Check it out and let me know what you think!

November 29th, 8:12 PM Uncategorized Read more Comments

Visual Studio 2008: First (Bad) Impressions

I’ve been running VS2008 Pro Beta 2 for awhile and had mostly good luck with it. There were only two recurring bugs that got to be annoying. The first was that after typing CssClass or class in the HTML source editor and hitting ‘=’ the automatic quotes (which I enabled in the settings) would be doubled so auto-complete would generate CssClass="""" instead of CssClass="". I found the bug in Connect and MS said it would be resolved in RTM.

Visual Studio Error Message The other bug popped up when I double-clicked a .aspx file in the solution explorer while the corresponding .aspx.cs file was already open. I’d get an "This document is opened by another project." error dialog but the file would open normally. I never took the time to track that bug down in Connect.

Today I download the RTM bits and the first bug still exists in a way. Now I don’t get any automatic quotes (I doublechecked that its enabled) for CssClass/class. So now on auto-complete I get CssClass= or class=. All other attribute names generate the auto quotes, even nonsense words. I reset my Visual Studio settings to the defaults and I still get the error.

As for the second bug, it still exists. I thought it might be VisualSVN causing it but the dialog title is "Microsoft Visual Studio" and it happens with web sites that aren’t in SVN.

Neither bug is a showstopper, but they are very aggravating. Is anyone else experiencing these issues?

UPDATE: The first bug only happens if you have no styles defined in your document or a linked stylesheet OR if VS hasn’t yet parsed your linked styles (it can take a few seconds after loading a document). Still annoying if you’re working on a new document and haven’t defined any styles yet. The second bug appears to be an issue with one of my add-ons as I was unable to replicate it on another machine. I don’t know which add-on yet.

UPDATE 2: MS was able to replicate the first bug and is going to fix it for a future release (thanks to the guys on the Web Dev Tools team for their quick and helpful responses!). After uninstalling all my add-ins, I narrowed the second bug down to VisualSVN and have contacted them to let them know.

November 19th, 9:59 PM .NET, Software Read more Comments