Getting started with ASP.Net

October 25, 2006

OK, here is another post that has been re-purposed from an email I sent. I had someone looking to get started on the .Net/ASP.Net platform and was looking for help. Since I could tell that I was probably going to get sucked into some type of longer term support role for this person, I decided to recommend some way that they could help themselves.

.Net as a platform is quite nice and brings a lot to the table in terms of development. Unfortunately, it also gives you lots of flexibility to do things in less than ideal ways. While it would be nice to just have one pattern for how to do something, quite the opposite is true and there is seldom consistency around anything.

So, for you as an apparent newbie to ASP.Net, I would recommend the following:
- A book or two on ASP.Net 2.0 is a great place to start. These come in handy for reference and some will actually walk you through building an application.
- Hang out at the ASP.Net Forums. There are many forums dedicated to complete newbies to .Net. What’s nice is you’ll get answers to your questions from someone who just walked in your shoes two weeks ago. I spent lots of time there several years ago when trying to make the break from ASP to ASP.Net
- Check out the Starter Kits. These are great sample apps to help you get a feel for how an ASP.Net app is built. And annoyingly enough, each one of these starter kits was built completely differently (at least back when I went through them). This would give me fits because I wanted to know the one “right way” to do things. You eventually pick and choose what works best for you and your situation.
- Another approach that I have recommended to several newbies at my day job is to purchase a subscription to LearnVisualStudio.net. You get access to over 500 videos (over 100 hours of content). You can’t really beat this concept. First, the price is just right - you can get a three month subscription for the price of a tech book. Second, the videos are awesome - great quality, great content.
- If you have your backend mapped out, you could look at tools like CodeCharge or Iron Speed. While I haven’t directly used either, I know CodeCharge has been around for several years and might actually be more along the lines of what you are looking for. They make it easy to take an application concept and generate the necessary code. One of our MyHomePoint competitors, HomeConvenience.com, appears to be built around such a concept/tool.
- If you are feeling really adventerous, you could download the source code for the ASP.Net Forums (and our site and many other sites around the web) The Microsoft developer (Rob Howard) originally working on those forums many years ago left and took the open source code with him to a new gig called Telligent where it was re-packaged as Community Server. They maintain the code and have extended it greatly. However, this is a project that has been under development for many years and is quite large. It could be quite daunting to just jump in and figure out your way around. But there are a lot of really good practices to learn from in the code. We implemented a lot of things we saw in there in our MyHP code.

Obviously there are tons of other resources out there, but these are a few of my favorite tactics. Anyone have any suggestions of their own?

Popularity: 22% [?]

ASP.NET AJAX Beta 1 Released

October 20, 2006

Scott Guthrie just announced the release of ASP.NET AJAX Beta 1. This is excellent news for us. We had recently tried to implement the Atlas June CTP but were running into some issues with Safari. Hopefully those issues will be resolved. From Scott:

Previous ASP.NET AJAX CTPs didn’t have great support for Safari (UpdatePanel didn’t work at all). With this Beta we have added Safari as a fully tested and supported browser.

Between ASP.NET AJAX, YUI and Jack Slocum’s Yahoo Extensions, looks like I’m going to be busy.

Popularity: 21% [?]

Issues with ASP.Net Atlas UpdatePanels and Safari

October 5, 2006

We are in the process of trying to incorporate some Atlas/AJAX into our site. What we added works correctly in IE6 and FF1.5 on Windows and also works correctly in Camino and FF (not sure of the version numbers) on Mac. However, it is not working correctly with Safari. Unfortunately I don’t have a lot of information on what the problem is since I don’t have reliable access to a Mac to dig into it.

While I don’t have specific error messages, we do have a test environment that you can check out. Please note that this test site is being served up through a DSL connection (small upload pipe) and might be a little slow (especially with all the extra overhead AJAX script, etc.). To reproduce the issue, do the following:

Log into our site with our test account by clicking here

  • Once you are in the site, click on the Calendar tab at the top
  • Once in the Calendar, make sure that you are viewing either the Day, Week or Month view (top-right below the main tabs)
  • On the left-hand side, there is a module called Mini Calendar that allows you to navigate through the calendar.
  • If you are on Day or Week view, click the links at the top of the Mini Calendar to navigate to the previous or next item (On Day or Week view, it will navigate by month. On Month view, it will navigate by year)
  • If you are using IE or FF, when you click the next or previous link, the content of the Mini Calendar should update with the previous or next view of the requested information (there is also a small ‘Loading’ graphic that appears in the top-right of the screen). In Safari, nothing happens and apparently there is a JavaScript error thrown.

I posted this to the ASP.Net forums but it isn’t getting much activity so I wanted to throw it out as a post to see if it pops up on anyone’s radar. Any help in getting to the bottom of this is appreciated.

Popularity: 10% [?]

Atlas for ASP.NET grows up

September 30, 2006

In case you missed it, a couple of weeks ago, Scott Guthrie posted the “Atlas” 1.0 Naming and Roadmap. In it, he mentions that Atlas will be a fully supported product with a ten year product lifetime, a 1.0 release should be coming soon, additional features are still planned, and marketing is staying busy giving it creative new names.

To follow up on Scott’s announcement, Rick Strahl has a good article about the current state of ATLAS. He talks objectively about where it currently is at and what needs to happen to get it where it needs to be. While not belaboring minute details, he does hit the highlights of what Atlas is currently doing well and what needs to be improved.

One interesting thing from Rick’s article is the following quote:

If you’re going down the AJAX path, JavaScript is going to become a more important part of your development environment. This will get easier when Orcas arrives, but in the meantime we have to struggle with the existing tools. Investing some time getting acquainted with JavaScript should probably be high on your list of skills to acquire as a Web developer. Learning about JavaScript object orientation, prototypes, function pointers, closures (an excellent reference can be found here: jibbering.com/faq/faq_notes/closures.html ) and a handful of other concepts specific to JavaScript is a prerequisite to use the ATLAS client library which uses some advanced concepts to provide abstraction and .NET like functionality.

I’ve been doing web development since 1995 and long ago became quite intimate with JavaScript and how to make it do all sorts of cool things (like AJAX back in early 2002 before it even had a name). Only recently as we have been trying to staff up for a project at my day job it has become very apparent that there is a whole generation of ASP.Net programmers that have completely relied on the framework to do the heavy lifting for them. Sometimes that can be good, but as with most things Microsoft, their controls tend to take you about 80% of the way towards your solution and then you need to look for ways to do it yourself. On my projects at my day job, we have taken great effort to separate the developer from the complexities of JavaScript. I’m not so sure why that is though. JavaScript is one of my favorite languages because of its simplicity and power. Granted, it is not always easy to work with since there weren’t any good editors or debuggers for so long, but you either baked your own, or now you can rely on some of the frameworks that are out there.

Popularity: 9% [?]

URL Rewriting with ASP.Net

March 15, 2006

I received the following question via email the other day. Brian said I should post my response since I hadn’t posted anything in a while. Hope it helps someone!

I need to intercept some URLs. All URLs to “/this/url” need to go to “this_page.aspx” no matter if they’re “/this/url/is/cool” or “/this/url/is/not”. In Apache world, I’d use a RewriteRule.

What do we do in .Net? I’ve found potential solutions in the Web.config — HttpHandlers and such.

But I don’t so much want to write a handler. I really just want to “catch” URLs and send them to a certain page.

What’s the best way?

You are getting into one of my personal pet peeves with asp.net. You would think that popularity, functionality, power and flexibility of mod_rewrite would have prompted MS to bring that same functionality over to ASP a long time ago. Especially considering how long it has been around. I think it is one of those things that they just don’t “get” - like why they shouldn’t mess with my HTML. I believe ASP.Net 2.0 has better built-in capabilities that I have not experienced first-hand, but I have heard that it still isn’t nearly as powerful as mod_rewrite.

If you own the server that you are deploying to, I would recommend Helicon Tech’s ISAPI_Rewrite. It implements the majority of the same functionality as mod_write but uses a slightly different syntax. It appears to just be one guy, but he’s been around a while (forum goes back to 2002) and he is good about responding in the threads. His pay product supports ISP functionality so that each account can have their own rules file, but if it is just you, you can manage a number of sites from one server with one rule file. That is what we do on our server that hosts FearlessDog / SwoofWare / ThinkFirst / etc. This solution is application independent too. The sites I just listed are all WordPress installs. I did a proof of concept a while back for MyHomePoint. We can’t move forward with clean urls for MyHomePoint though because our host doesn’t support it.

If you don’t own the server, then that presents a bit of a problem. As you mentioned, you can do a lot with handlers and there are some projects out there (CodeProject?) that take you the majority of the way there. However, you run into a variety of unseen issues (postbacks, resource files - images, styles, etc.). James Shaw had a brief post referencing several of the popular solutions. Of course, his conclusion was to not mess with it since there is no clean way to do it.

One of the biggest problems with the handler approach is that it is usually an all or nothing approach. In order for the handler to work, the request needs to get handled by the asp.net engine. To make that happen, you either need to intercept everything and then exclude stuff like images, stylesheets, scripts, etc. Or you put a .aspx extension on everything so that it is forced into the asp.net engine. In the asp.net world, these are clean urls:
- http://www.myhomepoint.com/forums/13/ShowForum.aspx
- http://www.myhomepoint.com/forums/thread/161.aspx
Those qualify as clean urls, right? Unfortunately, they aren’t platform agnostic which I believe is also one of the goals of url rewriting. Without the extension, it just assumes you are asking for a folder and then looks for a default.aspx file. If that isn’t found, then you are out of luck. Some solutions I’ve seen involve pre-defining your folder hierarchy and putting a default.aspx file in each folder. Needless to say, that approach has limitations.

You may consider looking at Community Server to see how they handle the problem with handlers. You can download the app and source. Looking at their code is probably a good thing to do regardless since you can get some good ideas on how to deal with other stuff.

While it is a lofty goal to achieve, my advice is that if you don’t own the server or have a host that supports the ISAPI_Rewrite component, then don’t try to implement it. You will burn far too many billable hours solving the inevitable quirks that pop up.

Hope that helps!

Popularity: 12% [?]

ISAPI_Rewrite Rules for WordPress on IIS

January 31, 2006

This seems like a no-brainer post. Not sure why I didn’t think of it before. These are the ISAPI_Rewrite rules that I am using for this WordPress installation running on Windows 2003 and IIS to get clean/pretty URLs:

The rules above summarize the various ISAPI_Rewrite forum threads related to WordPress. I really like the product and have had no issues and in general the support forum is great. However, as popular as we might like to think WordPress is, I don’t think they care because they really haven’t put forth much of an effort to really understand what the various posters are trying to accomplish. Here’s hoping that this helps.

How’s that for a short post to make up for the previous book I just wrote? Hope it helps. I don’t guarantee it is complete, but it seems to be working pretty well. Drop a note in the comments if I’m missing anything.

Popularity: 15% [?]

MyHomePoint

Having trouble keeping track of everything going on at home? Is the refrigerator organizer not cutting it anymore? We feel the same way...
Check out MyHomePoint »

Close
E-mail It