Thursday, July 3, 2003

ASP.NET Apps Without Web Projects

VS.NET Web Projects suck. If you’ve used them, you know this. Fritz has written up a little article that talks about how to create ASP.NET web pages and web services without using VS.NET web projects.  

Basically, he shows you how to enable the “Add Web Form” and “Add Web Service” wizards in a regular Library Project. That along with a few other small tweaks, and you’re ready to go.  


  1. Thank you for pointing this out. Wasn't sure if I was the only one!

  2. Oh, far from it, I suspect. ;)

  3. People say this all the time, but no one ever gives me a decent reason (or one that I think is decent) - can you ?

  4. If you're going to ask for a "decent" reason, then that make it rather subjective, don't you think? :) But here are mine:

    * Everything winds up with absolute URLs.
    * This makes it a huge PITA to move projects between machines, say in a team environment
    * The vdir it creates for you is always in the wrong place, meaning I have to create it by hand beforehand
    * When it asks me "open with FrontPage extensions or file share" I have no idea what's going on

    Are any of these insurmoutable? Absolutely not - most of them are at worst inconvenient, and some of them are equally a problem when using Library Projects. So the big reason for me not to like web projects is that I just find them unintuitive. With a Library Project I know what's going on, and it makes it very clear to me what I have to do.

  5. * Everything winds up with absolute URLs.
    Jon - Not sure about this one - can you explain more?
    * This makes it a huge PITA to move projects between machines, say in a team environment
    Jon - moving between machines in a team environment isn't difficult if you just pay attention to the vdir issues, if you want to change the path - it is just in the .webinfo file.
    * The vdir it creates for you is always in the wrong place, meaning I have to create it by hand beforehand
    Jon - I know alot of people find this a pain in development - but IMO - having your vdirs under wwwroot makes the most sense for a) security reasons - you don't have to give the ASPNET/Network Service rights to addtional directories b) on a given server - having vdirs at random paths can be confusing for an admin or another dev c) having all vdirs in one physical directory makes admin things like backup easier
    * When it asks me "open with FrontPage extensions or file share" I have no idea what's going on
    Well - I always find this a lame reason - sorry Craig. Kind of like saying "when I get a csharp compiler error I have no idea what is going on". People should know the tool. FrontPage extensions vs file share is a default (file share is the default). Fileshare works best on a local machine or local network, FP works best over a longer connection - because it uses port 80 and http only, it can get around firewall issues etc. Maybe you need a copy of Mastering Visual Studio .NET ;-)

  6. So, I'm not going to argue that to the guy that wrote "Mastering Visual Studio.NET" all that stuff is easy. I'm even glad to hear that all my complaints are groundless by virtue of being able to do the things I say I don't know how to do.

    However, the fact remains that quite a few people that I know hate web projects because they are counterintuitive. That suggests that there's something basically wrong with the way they're handled.

    And let's turn the argument around, anyway: can you give me one decent reason (one that I think is decent ;) ) why I *should* use web projects when I can just make a class library project? The only one I can think of is the deployment wizard, that copies the content files to a different web server, and that isn't sufficient to counter all the times I wind up having to try to figure out what VS.NET is doing with my web project.

  7. Well - your complaints may or may not be groundless - that is what I am trying to figure out :)

    Why use webprojects? Well - first - you have to change the way VS.NET works to make all the designers work correctly with a class library project. This is bad for me - since I teach courses and showing students how to use a standard tool in a non-standard way IMO is broken, since likely they will not be able to replicate when the get back to work, and likely will they WILL use webprojects.

    The biggest complaint I hear about webprojects is that you need a virtual directory. Well - you need a virtual directory just to make a web application work - this is an ASP.NET requirement - not a web project requirement. So even if you use a class library project - you STILL have to go and configure the virtual directory (which was one of your complaints about webprojects - that you had to go create the vdir first - seems inconsistent since you have to do that ALL the time with a class library project).

    Most of the people who say this are from our company - and generally our company has had a history of high standards when it comes to having rationales for the assertions we make. In this area - I have found the rationales to be rather loose - "Well - it must be counterintuitive" I just don't buy that - not that I think there isn't any way webproject might be broken - lots of things in VS.NET are broken :)

    I recommend webprojects because they take care of:
    a) making a vdir
    b) automatic debugging - setting a start page for debug
    c) copying a webproject (including setting up the vdir on the remote machine - which is going to have to happen somehow)
    d) no mess use of designers
    e) remote server builds (web server doesn't have to be on my local machine)

    There really isn't much to know about webproject - it isn't really complicated - in essence it is a class library project that builds locally and copies the assembly and any saved files to a webserver (could be local or remote). It copies them either via FPSE or a file share (with file share being the default). That is really it.

  8. You are a very persuasive man, Jon Flanders. :)

    Here are my big issues. They may simply be that I don't understand the way that VS.NET works, but since I seem to get most things in VS.NET without too much trouble, I assert that that is simply proof that these are counterintuitive, and therefore annoying:

    1) Debugging seldom works right for me with F5. I have to Debug->Processes->Attach manually.
    2) Absolute URLs seem to make their way into the project file, so when I move a web project to someone else's machine it won't open properly.
    3) The place it creates the vdir by default also complicates moving a solution that might consist of twelve or more projects - I can't just grab a directory hierarchy. Sure, I can create the vdir manually, but that negates one of the advantages.
    4) When I do try to open a project I've moved or goofed with in some way or breathed on wrong, I get dialog boxes "Open with file share" and "Open with Front Page extensions" that I don't understand.

    Again, all of these might well be fixable by removing my ignorance. But the experience has been a bad one, and the things you site (making a vdir, copying projects, etc.) are things I either already know how to do easily by hand, that I don't care about, or that don't usually work for me anyway.

  9. 1) No clue there
    2) Not sure - sometimes the designers put them in - which in the case of the designers - doesn't matter if it is a webproject or not
    3) Yes - when you have a webproject as part of a bigger solution - creating the vdir first makes sense - you said you create them easily anyway - so why not for a webproject vs class library? That's the one I don't understand the most when people say it - "I don't like to create the vdir manually" - but you *have* to for a class library project anyway - that perplexes me.
    4) Making the vdir before you open the solution fixes this error.

  10. Well, there you have it, then. :)

    BTW, I'm not saying, "I don't like to create the vdir manually." I'm fine with that. I'm saying that since I have to in order to use it the way I want, that one of the advantages you site for using web projects disappears.

    I used web projects extensively until recently. I'll reconsider using web projects in light of what you've told me once I've done it the other way for a while.

  11. I've followed the instructions on the blog and can get the page to open with the debugger however if I set a breakpoint it is ignored. Can you help?

  12. First things first: the up-to-date instructions are here [1]. Those are the ones you read?


  13. Thank you! I found what I needed to know at:

  14. Can I know how to Send SMS througj asp.ner

  15. Sorry - I don't know what you're asking. Can you explain further?

  16. Hi Guys,

    Just to chime in here, after finishing up a project of a couple of weeks, I tried to setup a new project on a local VS.NET/IIS install. I've setup my sites with FQDNs that point to individual IP addresses very similar to a production environment. Everything was working fine until I tried to create a new project at the root of a newly created web site. I keep getting the

    "Unable to create open project <project name>. The file path <project path> does not correspond to the URL <project url>. The two need to map to the same server location."

    Well, they are mapped to the same place, but for what ever reason, VS.NET can't resolve. Also, when I try via IP address instead of a domain name, I get the same error, but once I press 'OK' to the path it gives me (which is the correct one), the project loads. But if I close the project, it's the same thing again, and again.

    I know I've got a bit of a different setup than most, but conceptually it's all the same,

    project on file system = project on web server.

    Anyways, enough of my rant, off to figuring this out.

  17. Back again with a solution! (Sort of). The problem I was having was due to the fact that I had mapped .htm files to asp.dll (something I was trying out). Anyways, apparently VS.NET 2k2 creates a .tmp file & asks for it back, and that causes the problem with VS.NET 2k2, but I was using 2k3, which reminded me of the script mapping, I removed it and all worked well.

    Just wanted to post the solution for my particular problem incase anyone else has it!

    Here's the support article that helped me:;en-us;327283

    Happy Programming!

  18. hoe can it's posssible,

    decribe more ???

  19. The article can now be found at