有关使用ASP.net WebForms或MVC的建议

时间:2021-06-30 03:22:29

I have a public facing hobby site that gets about 3000 unique visitors a day, written in classic ASP that is in bad need of a revamp and redesign. I've faced the realization that an upgrade to ASP.net is the best way to go to implement features that are just too hard in ASP for the hobbyist (consuming RSS feeds, authentication and user profiles) but which I'm keen to get stuck into once I get past the redesign/upgrade.

我有一个面向公众的爱好网站,每天约有3000名独立访客,用经典的ASP编写,不太需要改造和重新设计。我已经意识到升级到ASP.net是实现功能的最佳方式,这些功能对于业余爱好者来说太难了(使用RSS提要,身份验证和用户配置文件),但是我很想得到它坚持到一次我通过重新设计/升级。

But, I have been paralysed with uncertainty about which way to go: Web Forms or MVC - plus the fact that there always seems to be some new release about to launch that seems like it would be worth holding out for to improve the learning curve. So I spend hours reading about WebForms then read something that tells me I might be better off thinking about MVC, then read about MVC and wonder whether it actually suits what I'm trying to do.

但是,我已经陷入了瘫痪状态的不确定性:Web表单或MVC - 以及似乎总会有一些新版本即将发布,似乎值得坚持改善学习曲线。所以我花了几个小时阅读WebForms,然后读了一些东西告诉我,我可能会更好地考虑MVC,然后阅读MVC,并想知道它是否真的适合我正在尝试做的事情。

None of the tutorials and starter sites really talk about what works well for sites that are traditional old static information sites (not catalogues or user-content-driven).

没有任何教程和入门网站真正谈论哪些网站是传统的旧静态信息网站(不是目录或用户内容驱动)。

My site is about 75% static information pages that rarely change. However, the ASP scripting is essential in the user interface on all those pages - dynamically or randomly picking design elements (like a header photo) or providing a particular sidebar box based on the day of the year or at random.

我的网站大约有75%的静态信息页面很少改变。但是,ASP脚本在所有这些页面上的用户界面中是必不可少的 - 动态或随机选择设计元素(如标题照片)或根据一年中的某一天或随机提供特定的侧边栏框。

The kind of scripting I have is things like a script to randomly pick and display one of 30 header images for the page, a script to display text and links based on what day of the year it is, a script that allows me to declare a particular search keyword as being relevant to the content for a particular page and having that pre-loaded as the text in the search input box when the page loads.

我所拥有的那种脚本就像是一个脚本,可以随机选择并显示页面的30个标题图像之一,一个显示文本的脚本和基于一年中某一天的链接,一个允许我声明一个脚本的脚本特定搜索关键字与特定页面的内容相关,并且在页面加载时将其预加载为搜索输入框中的文本。

For most of the rest of the pages, they are about displaying data. Some of them are small recordsets (almanac type information about what is significant about this particular day of the year) and I save it and pull it from an Array variable in the page itself. Others pull information from an Access database that changes rarely enough that I've never bothered implementing CUD functionality live on the site (and the necessary roles and authentication to secure it), but just update the database offline and upload it to send the changes live.

对于大多数其余页面,它们都是关于显示数据。其中一些是小记录集(关于一年中特定日期的重要内容的历书类型信息),我将其保存并从页面本身的Array变量中提取。其他人从Access数据库中提取信息,该数据库变化很少,我从来没有在网站上实现CUD功能(以及必要的角色和身份验证来保护它),但只是离线更新数据库并上传它以实时发送更改。

With ASP.net, I would be fine moving to SQL Server and building live administration pages. I don't need to stick with Access.

使用ASP.net,我可以很好地迁移到SQL Server并构建实时管理页面。我不需要坚持使用Access。

But, I'm more used to writing raw HTML and CSS and I'm finding WebForms (especially Viewstate and events/postbacks) a challenge to get my head around conceptually. Even though it seems to fit more with the static page in a file system with some server-side code that I'm used to.

但是,我更习惯于编写原始HTML和CSS,而且我发现WebForms(特别是Viewstate和事件/回发)是一个挑战,可以从概念上理解。即使它似乎更适合文件系统中的静态页面,但我已经习惯了一些服务器端代码。

On the other hand, MVC seems to be well suited to lovingly hand-coded design, but where everything gets pulled from a database.

另一方面,MVC似乎非常适合手工编码的设计,但是从数据库中提取所有东西。

What would you recommend? Should I pull all the static pages into a database and serve them through an "article" view in MVC?

你会推荐什么?我应该将所有静态页面拉入数据库并通过MVC中的“文章”视图提供它们吗?

I'm not a professional developer - so it's not about what will look best on my resume. I'm just looking for what will (a) have the least learning curve for someone coming from VBScript inline expressions in classic ASP and (b) what best suits what my site does and (c) lets me have some control over the mark-up and CSS.

我不是一个专业的开发人员 - 所以这不是关于什么在我的简历上看起来最好。我只是在寻找(a)来自经典ASP中来自VBScript内联表达式的人的最少学习曲线,以及(b)最适合我的网站的内容和(c)让我对标记有一些控制权 - 和CSS。

7 个解决方案

#1


7  

Definitely go MVC, especially if you're more comfortable as an HTML/CSS guy. Postbacks offer no advantage for a site that is largely static, and it will take months for you to get your head around the page lifecycle (I have yet to meet a developer who was a master of the lifecycle after 6 months of coding in it.)

绝对是MVC,特别是如果你作为一个HTML / CSS家伙更舒服的话。对于一个基本上是静态的站点,回发没有任何优势,并且您需要花费几个月的时间来了解页面生命周期(我还没有遇到一个开发人员,他在编码6个月之后就是生命周期的主人。 )

Converting an ASP classic site to MVC will basically involve moving your HTML and ASP tags into Views, and replicating your existing URL's using the routing mechanisms. You'll need to upgrade your scripts to use some more modern functionality, but that should be fairly straightforward I would imagine.

将ASP经典站点转换为MVC基本上涉及将HTML和ASP标记移动到视图中,并使用路由机制复制现有URL。您需要升级脚本以使用更现代的功能,但这应该是我想象的相当简单。

I do disagree with the idea that in MVC everything is pulled from the database - that's a bit irrelevant to the architecture. I've coded 100% static sites in MVC frameworks and loved it :)

我不同意在MVC中从数据库中提取所有内容的想法 - 这与架构有点无关。我在MVC框架中编写了100%的静态站点,并且喜欢它:)

My rule of thumb is trending towards this: "MVC for websites, WebForms for enterprise web applications - maybe."

我的经验法则趋向于:“用于网站的MVC,用于企业Web应用程序的WebForms - 可能。”

#2


4  

MVC is well suited to what you're doing.

MVC非常适合您正在做的事情。

It's perfectly okay to have views which are static, if need be. Just take a look at what's generated by MVC's File->New Project template, for example.

如果需要的话,拥有静态的视图是完全可以的。例如,只需看看MVC的File-> New Project模板生成的内容。

Considering that you're already accustomed to writing HTML/CSS and both frameworks will present a learning curve, I'd definitely recommend MVC. I think you'll find MVC fits requirements A and C much better than WebForms too (and both satisfy B).

考虑到你已经习惯于编写HTML / CSS并且两个框架都会呈现学习曲线,我肯定会推荐MVC。我认为你会发现MVC适合要求A和C也比WebForms好(并且都满足B)。

#3


2  

Considering your experience I'll suggest you to use ASP.NET MVC. Since you're familiar with HTML & CSS you'll have to get used to the MVC pattern which is less than a week work. Also MVC is better and faster for just showing a data and it supports output caching so you can cache static pages and achieve awesome speed. Also it's not a problem to use a mix-up between the two - you can still have WebForms pages and use the controls where you need them.

考虑到您的经验,我建议您使用ASP.NET MVC。由于您熟悉HTML和CSS,因此您必须习惯不到一周工作的MVC模式。此外,MVC对于显示数据更好更快,并且它支持输出缓存,因此您可以缓存静态页面并实现极佳的速度。使用两者之间的混淆也不是问题 - 您仍然可以拥有WebForms页面并使用您需要的控件。

#4


2  

From my experience of passing from ASP to ASP.NET and ASP.NET MVC, it is easier to pass from ASP to ASP.NET MVC. However, the curve of learning is not so easy Please read and follow http://nerddinnerbook.s3.amazonaws.com/Intro.htm and , after you have read, see what's new in version 2 , for example :

根据我从ASP传递到ASP.NET和ASP.NET MVC的经验,从ASP传递到ASP.NET MVC更容易。但是,学习的曲线并不那么容易请阅读并遵循http://nerddinnerbook.s3.amazonaws.com/Intro.htm,阅读之后,请查看版本2中的新功能,例如:

weblogs.asp.net/scottgu/archive/2010/01/10/asp-net-mvc-2-strongly-typed-html-helpers.aspx

It will become a RAD for experienced developers!

它将成为经验丰富的开发人员的RAD!

#5


0  

Use what is most productive, if you are familiar with webforms and like the event-driven model you can always look into MVP ( Model-View-Presenter ).

使用效率最高的东西,如果您熟悉webforms并且喜欢事件驱动的模型,您可以随时查看MVP(Model-View-Presenter)。

ASP.NET MVC is really great and for me, it increases productivity.

ASP.NET MVC非常棒,对我来说,它可以提高生产力。

#6


0  

First of all you really need to make sure that a rewrite is worth the effort. In my experience rewrites take much more work than expected and have a long payback time. That doesn't mean they shouldn't be done, it does mean there have to be a really good reasons to start one. The features you mention can easily be implemented in classic ASP in just a fraction of the time. A legacy application are battle scared by tweaks, bugfixes and hidden features. A rewrite generally means losing those years of experience. It all depends on the current features/ new features ratio.

首先,你真的需要确保重写是值得的。根据我的经验,重写需要比预期更多的工作,并且有很长的投资回收期。这并不意味着他们不应该这样做,这确实意味着必须有一个非常好的理由来启动它。您提到的功能可以在很短的时间内轻松地在经典ASP中实现。遗留应用程序通过调整,错误修正和隐藏功能而受到惊吓。重写通常意味着失去那些年的经验。这一切都取决于当前的功能/新功能比例。

Secondly, if you are going to rewrite, you might also want to checkout technologies besides asp.net. The site you describe seems to be very content orientated which might better fit django than asp.net mvc. Good luck with your site.

其次,如果你要重写,你可能还想要检查除asp.net之外的技术。您描述的网站似乎非常注重内容,可能比asp.net mvc更适合django。祝你的网站好运。

#7


0  

I would also recommend you to use ASP.NET MVC as you are pretty much familiar with HTML/CSS. Also with the features like Routing you can organize the structure of the website in a more better way. Also your website becomes much more predictive for visitors because of the URL's.

我还建议您使用ASP.NET MVC,因为您非常熟悉HTML / CSS。此外,通过路由等功能,您可以更好地组织网站的结构。此外,由于URL的原因,您的网站对访问者的预测性更强。

Example :

www.domain.com/hobbies/photography

#1


7  

Definitely go MVC, especially if you're more comfortable as an HTML/CSS guy. Postbacks offer no advantage for a site that is largely static, and it will take months for you to get your head around the page lifecycle (I have yet to meet a developer who was a master of the lifecycle after 6 months of coding in it.)

绝对是MVC,特别是如果你作为一个HTML / CSS家伙更舒服的话。对于一个基本上是静态的站点,回发没有任何优势,并且您需要花费几个月的时间来了解页面生命周期(我还没有遇到一个开发人员,他在编码6个月之后就是生命周期的主人。 )

Converting an ASP classic site to MVC will basically involve moving your HTML and ASP tags into Views, and replicating your existing URL's using the routing mechanisms. You'll need to upgrade your scripts to use some more modern functionality, but that should be fairly straightforward I would imagine.

将ASP经典站点转换为MVC基本上涉及将HTML和ASP标记移动到视图中,并使用路由机制复制现有URL。您需要升级脚本以使用更现代的功能,但这应该是我想象的相当简单。

I do disagree with the idea that in MVC everything is pulled from the database - that's a bit irrelevant to the architecture. I've coded 100% static sites in MVC frameworks and loved it :)

我不同意在MVC中从数据库中提取所有内容的想法 - 这与架构有点无关。我在MVC框架中编写了100%的静态站点,并且喜欢它:)

My rule of thumb is trending towards this: "MVC for websites, WebForms for enterprise web applications - maybe."

我的经验法则趋向于:“用于网站的MVC,用于企业Web应用程序的WebForms - 可能。”

#2


4  

MVC is well suited to what you're doing.

MVC非常适合您正在做的事情。

It's perfectly okay to have views which are static, if need be. Just take a look at what's generated by MVC's File->New Project template, for example.

如果需要的话,拥有静态的视图是完全可以的。例如,只需看看MVC的File-> New Project模板生成的内容。

Considering that you're already accustomed to writing HTML/CSS and both frameworks will present a learning curve, I'd definitely recommend MVC. I think you'll find MVC fits requirements A and C much better than WebForms too (and both satisfy B).

考虑到你已经习惯于编写HTML / CSS并且两个框架都会呈现学习曲线,我肯定会推荐MVC。我认为你会发现MVC适合要求A和C也比WebForms好(并且都满足B)。

#3


2  

Considering your experience I'll suggest you to use ASP.NET MVC. Since you're familiar with HTML & CSS you'll have to get used to the MVC pattern which is less than a week work. Also MVC is better and faster for just showing a data and it supports output caching so you can cache static pages and achieve awesome speed. Also it's not a problem to use a mix-up between the two - you can still have WebForms pages and use the controls where you need them.

考虑到您的经验,我建议您使用ASP.NET MVC。由于您熟悉HTML和CSS,因此您必须习惯不到一周工作的MVC模式。此外,MVC对于显示数据更好更快,并且它支持输出缓存,因此您可以缓存静态页面并实现极佳的速度。使用两者之间的混淆也不是问题 - 您仍然可以拥有WebForms页面并使用您需要的控件。

#4


2  

From my experience of passing from ASP to ASP.NET and ASP.NET MVC, it is easier to pass from ASP to ASP.NET MVC. However, the curve of learning is not so easy Please read and follow http://nerddinnerbook.s3.amazonaws.com/Intro.htm and , after you have read, see what's new in version 2 , for example :

根据我从ASP传递到ASP.NET和ASP.NET MVC的经验,从ASP传递到ASP.NET MVC更容易。但是,学习的曲线并不那么容易请阅读并遵循http://nerddinnerbook.s3.amazonaws.com/Intro.htm,阅读之后,请查看版本2中的新功能,例如:

weblogs.asp.net/scottgu/archive/2010/01/10/asp-net-mvc-2-strongly-typed-html-helpers.aspx

It will become a RAD for experienced developers!

它将成为经验丰富的开发人员的RAD!

#5


0  

Use what is most productive, if you are familiar with webforms and like the event-driven model you can always look into MVP ( Model-View-Presenter ).

使用效率最高的东西,如果您熟悉webforms并且喜欢事件驱动的模型,您可以随时查看MVP(Model-View-Presenter)。

ASP.NET MVC is really great and for me, it increases productivity.

ASP.NET MVC非常棒,对我来说,它可以提高生产力。

#6


0  

First of all you really need to make sure that a rewrite is worth the effort. In my experience rewrites take much more work than expected and have a long payback time. That doesn't mean they shouldn't be done, it does mean there have to be a really good reasons to start one. The features you mention can easily be implemented in classic ASP in just a fraction of the time. A legacy application are battle scared by tweaks, bugfixes and hidden features. A rewrite generally means losing those years of experience. It all depends on the current features/ new features ratio.

首先,你真的需要确保重写是值得的。根据我的经验,重写需要比预期更多的工作,并且有很长的投资回收期。这并不意味着他们不应该这样做,这确实意味着必须有一个非常好的理由来启动它。您提到的功能可以在很短的时间内轻松地在经典ASP中实现。遗留应用程序通过调整,错误修正和隐藏功能而受到惊吓。重写通常意味着失去那些年的经验。这一切都取决于当前的功能/新功能比例。

Secondly, if you are going to rewrite, you might also want to checkout technologies besides asp.net. The site you describe seems to be very content orientated which might better fit django than asp.net mvc. Good luck with your site.

其次,如果你要重写,你可能还想要检查除asp.net之外的技术。您描述的网站似乎非常注重内容,可能比asp.net mvc更适合django。祝你的网站好运。

#7


0  

I would also recommend you to use ASP.NET MVC as you are pretty much familiar with HTML/CSS. Also with the features like Routing you can organize the structure of the website in a more better way. Also your website becomes much more predictive for visitors because of the URL's.

我还建议您使用ASP.NET MVC,因为您非常熟悉HTML / CSS。此外,通过路由等功能,您可以更好地组织网站的结构。此外,由于URL的原因,您的网站对访问者的预测性更强。

Example :

www.domain.com/hobbies/photography