4

I have been looking at ASP.Net Web Pages and I think it would be a good replacement for some classic asp sites I am working on. There is a lot about them that is similar to how classic asp did things, so I believe there is a chance I can drag the other programmers into the present. My problem is that I have yet been able to find any indepth documentation to see if there is any "gotchas" I need to be aware of if I choose to go down this path. So if anyone knows of any, I could really use that information. I think going straight to MVC and Web Forms would be a bridge too far for the others at the moment. Thanks.

Wade

I found a link from Mike Brind - should I use WebMatrix to build a real-world website?

Community
  • 1
  • 1
Wade73
  • 4,359
  • 3
  • 30
  • 46
  • what do you mean by "gotchas"? Are you referring to using WebMatrix or doing websites in ASP.net vs ASP? Also what types of sites are these? – Robert Dec 22 '11 at 14:38
  • @Robert I mean anything that you won't find in the Microsoft documentation, but would cause me a headache when I try to roll the site out. As for the sites, one is an internal website for doing repairs. So I need db access, grids, data validation, etc... One other is an ecommerce site. The last one is a CMS. – Wade73 Dec 22 '11 at 18:28

5 Answers5

4

I'd suggest that Web Pages as a framework is probably the best next step you can take, but I would also advise that at least one person in the team takes time to understand the basics behind the MVC pattern. You may decide it's too much for the majority of the team at the moment, and that's fair enough, but you can use your knowledge to plan the development of the Web Pages site so that it can be more easily converted to MVC at some stage in the future, should you decide that's the way to go.

The things I would look at (coming from a classic ASP background myself) are functions and helpers. Decide on a data access strategy - The Entity Framework works well with Web Pages and can be transferred to MVC easily. Avoid the Database helper. Use Visual Web Developer 2010 SP1 for the Intellisense option.

As Knox said, you have the whole of the ASP.NET framework available to you so there should be no Web Pages specific "gotchas", and it's a massive step up from classic ASP.

Mike Brind
  • 28,238
  • 6
  • 56
  • 88
  • That was what I thought, but I wanted to go on more that that. I have looked at MVC, but it is a bit much for what I need at this point, plus I think Web Pages would help the other developers to get on board. Warning Plug! - I know you wrote a book about Web Matrix (http://www.amazon.com/Beginning-ASP-NET-Web-Pages-WebMatrix/dp/1118050487/ref=sr_1_3?ie=UTF8&qid=1295304399&sr=8-3), but it seemed more geared to novices, so I didn't look any further into it. Thanks again! – Wade73 Dec 22 '11 at 18:58
  • Also I thought I might follow @ScottHanselman and use massive for the data access layer. – Wade73 Dec 22 '11 at 19:01
4

I've been using Webmatrix/WebPages/Razor for a while now and like it. It's been a while since I used Classic ASP, but WebPages to me feels like a true successor to classic asp and what ASP.net should have been from the start. I'm actually moving most of my smaller sites to the WebPages framework from WebForms. Here are some things I've encountered.

I'm not sure if this is a gotcha or not, but I thought I would mention that with WebPages the scope of your variables may behave differently. I know a lot of Classic ASP sites that used to use include files to run snippets of code. Many of them depended on global variables set in the parent document. In WebPages, if you use RenderPage or Helpers to replace includes they run mostly outside of the Parent's scope. If you used Server.Execute instead of includes then you might not notice much difference, but if you did use includes and lots of global variables you may notice it.

Another possible gotcha is in ClassicASP <%=%> doesn't encode output, but in WebPages the Razor syntax @ encodes output by default.

Another thing to consider is using C# vs VB.net with Webpages. Although vb.net works you'll find that most samples, tutorials and people in forums use C#.

Finally something that bothers me is that it is named the "webpages" framework. I've found it hard to do a good Google search using the term "webpages". Even "asp.net webpages" brings back mostly webform results. I have more success using "webmatrix" or "razor".

dtc
  • 10,136
  • 16
  • 78
  • 104
  • Thanks for the info. The reason I asked is due to the fact that it is so hard to find any information about "ASP.Net Web Pages" I heard Phil Haack say he didn't like the name. Oh well! – Wade73 Dec 28 '11 at 11:56
  • Yes, I wish they would change it to something else. Calling it just "webmatrix framework" or the "razorpages framework" would have been better imo. As it is developers can barely find out what the "web pages framework" is since "asp.net web pages" can apply to anything asp.net related. – dtc Dec 29 '11 at 02:09
  • Exactly, I have customers I am trying to get out of "classic asp" and I think this is a great framework to use. How many others could really benefit from something like this, while trying to transition into the 21st Century!?!? As I said, oh well. – Wade73 Dec 29 '11 at 02:17
2

Can't recommend any documentation but here is an introduction to Web Matrix on mikesdotnetting.com blog where he has blogged quite a lot about Web Pages with Web Matrix.

Nicholas Murray
  • 13,305
  • 14
  • 65
  • 84
1

We have two production sites, developed using Web Matrix. One serves our customers, the other is an intranet for our staff. They've been running in production for almost a year. I'd say about 95% of the sites were developed purely in WebMatrix IDE with about 5% going into Visual Studio, especially for the occassional obscure debugging. We're happy with WebMatrix / Web Pages. I didn't use WebForms because I was concerned about WebForm's ability to do really lightweight pages, since many of our users are using cellular data on iPads or iPhones. I didn't use MVC because of the additional complexity, since many of our pages are just showing the user read-only data from our production database. Because WebMatrix gives you access to the complete ASP.NET library, I haven't felt held back at all.

Knox
  • 2,909
  • 11
  • 37
  • 65
  • Thanks this is what I am looking for. Was there anything that you had to do a workaround for? – Wade73 Dec 22 '11 at 18:29
  • WebMatrix doesn't currently give you a lot of help for validation. We're using jquery validation where we need it. I believe they've improved it in WebMatrix 2.0 but we couln't wait. – Knox Dec 22 '11 at 19:36
  • @Knox - OTOH, what's there in v1 is miles better than anything in classic ASP. – Mike Brind Dec 23 '11 at 09:13
0

We are currently converting our ASP pages to Web Matrix. We tried to do conversions using WebForms a few years ago, only ending in frustration. After a small learning curve on the C# and Razor syntax, our development staff feel that we made a correct decision in going with Web Matrix.