如果我更喜欢对网站的HTML进行细粒度控制,我应该学习ASP.NET吗?

时间:2022-05-18 03:18:20

For months, I've been considering downloading Microsoft's express web platform and learning ASP.NET, which I might actually enjoy, seeing as I already do web work with PHP, but am much more comfortable with C#.

几个月来,我一直在考虑下载微软的快速网络平台和学习ASP.NET,我可能真的很喜欢,因为我已经使用PHP进行网络工作了,但是对C#感觉更舒服。

However, the primary reason I don't want to do this is that I've always associated ASP.NET with useless spaghetti HTML. The link I posted is an excellent example. Would it be possible to use ASP.NET in a context more similar to PHP, using it to power my site but not leaving the HTML, CSS, and JavaScript to be done by hand for validation and semanticity reasons?

但是,我不想这样做的主要原因是我总是将ASP.NET与无用的意大利面条HTML相关联。我发布的链接是一个很好的例子。是否可以在更类似于PHP的上下文中使用ASP.NET,使用它来为我的网站提供支持,但是为了验证和语义原因,不要手动完成HTML,CSS和JavaScript?


EDIT

I've decided I'm not going to learn ASP.NET and stick with PHP.

我已经决定不打算学习ASP.NET并坚持使用PHP。

While MVC sounds nice, for me it will likely end up being a development/debugging headache.

虽然MVC听起来不错,但对我来说,它可能最终会成为开发/调试的头疼问题。

8 个解决方案

#1


Things get much better if you use ASP.NET MVC. I recommend you skip ASP.NET WebForms and jump to MVC directly.

如果使用ASP.NET MVC,事情会变得更好。我建议你跳过ASP.NET WebForms并直接跳转到MVC。

#2


If you are going to use Classic ASP.NET Web Forms, you really need to learn how it works to avoid truely ugly html. If you know what you are doing, you can get close to what you want (you can't completely get rid of ViewState & it will do some ugly thing with element IDs)

如果您打算使用经典ASP.NET Web窗体,您真的需要了解它是如何工作的,以避免真正丑陋的HTML。如果你知道自己在做什么,你可以接近你想要的东西(你不能完全摆脱ViewState,它会用元素ID做一些丑陋的事情)

A lot of the ugliness of Classic ASP.NET occures when people write web forms like they wrote VB 6 Windows applications.

当人们编写类似于编写VB 6 Windows应用程序的Web表单时,会发生很多经典ASP.NET的丑陋。

ASP.NET MVC is a good option. It may be the way to go as a starting point; I would like to switch to it myself. I guess my point is that you can get less ugly HTML using Classic ASP.NET.

ASP.NET MVC是一个不错的选择。这可能是一个出发点的方式;我想自己切换到它。我想我的观点是你可以使用Classic ASP.NET获得不那么难看的HTML。

#3


you're really going to want to check out the asp.net mvc. it allows you to develop in a manner a lot more suited for the web than vanilla webforms.

你真的想要查看asp.net mvc。它允许您以比香草网格更适合网络的方式进行开发。

#4


First of all, ASP.Net, even using webforms, does allow you to have complete control over the markup output. Of course it's easier for some cases than others, but anywhere you find you're not getting the html you want out of a control you can always replace the render behavior with a ControlAdapter.

首先,即使使用webforms,ASP.Net也允许您完全控制标记输出。当然,对于某些情况来说,它比其他情况更容易,但是如果您发现自己没有从控件中获取所需的html,则可以始终使用ControlAdapter替换渲染行为。

That said, as others have mentioned you'll probably find it's much easier to get the exact html markup you want using ASP.Net MVC.

也就是说,正如其他人所说,你可能会发现使用ASP.Net MVC获得你想要的确切html标记要容易得多。

#5


MVC.net and WebForms are built upon ASP.net

MVC.net和WebForms建立在ASP.net之上

You can get a decent amount of control with webforms by disabling viewstate and not using any controllers (or very few). Its all in how much you let it do for you

通过禁用viewstate而不使用任何控制器(或很少),您可以通过webforms获得适当的控制。这就是你让它为你做多少

#6


If you are looking to acquire skills in the latest and greatest, then MVC is where you should start but I would also consider whether you will ever be asked to support ASP.Net Webforms. Having an understanding of ViewState is crucial to that end.

如果您希望获得最新和最好的技能,那么MVC就是您应该开始的地方,但我也会考虑是否会要求您支持ASP.Net Webforms。了解ViewState对此至关重要。

For fine grained HTML output, you can produce this in many different ways with classic ASP.Net. There is a growing group of developers who are using a mixture of ASP.Net and microtemplating with Javascript to produce RIA's. This inevitably leads to keeping your html output cleaner so that it can be manipulated with jQuery and CSS.

对于细粒度的HTML输出,您可以使用传统的ASP.Net以多种不同的方式生成它。有越来越多的开发人员使用ASP.Net和微软模板与Javascript混合生成RIA。这不可避免地导致您的html输出更加清晰,以便可以使用jQuery和CSS进行操作。

#7


Learn ASP.NET MVC as it will give you more control over the html generated. Also learning ASP.NET will increase your job opportunities significantly.

学习ASP.NET MVC,因为它可以让你更好地控制生成的html。学习ASP.NET也会大大增加你的工作机会。

#8


My first real development in ASP.NET was with MVC, and I must say I truly miss it now that I'm onto the next project using webforms. Each has it's place and webforms is working pretty well for what I'm doing (also using it as an opportunity to learn about TableAdapters and what not) but I really do miss being able to insert the data I need right into the HTML. That way I know the layout I've built won't get screwed up.

我在ASP.NET中的第一个真正的开发是使用MVC,我必须说我现在真的很想念它,因为我正在使用webforms进入下一个项目。每个都有它的位置和webforms在我正在做的事情上工作得很好(也使用它作为了解TableAdapters的机会,但是我真的很想错过能够将我需要的数据插入到HTML中。这样我知道我建立的布局不会搞砸了。

As a framework I enjoy ASP.NET quite a bit, but the controls on the page seems so far removed from anything resembling HTML that there is often a mental disconnect with what I'm typing with what I'm expecting to see. I was that way when I first started HTML though, so I imagine I'll get used to it. When I started with MVC it was overall a much more enjoyable experience coming from a front-end background.

作为一个框架,我非常喜欢ASP.NET,但是页面上的控件似乎远离了类似于HTML的东西,以至于我正在用我期待看到的内容进行精神上的断开。当我第一次启动HTML时,我就是那样,所以我想我会习惯它。当我开始使用MVC时,从前端背景来看总体上是一种更愉快的体验。

#1


Things get much better if you use ASP.NET MVC. I recommend you skip ASP.NET WebForms and jump to MVC directly.

如果使用ASP.NET MVC,事情会变得更好。我建议你跳过ASP.NET WebForms并直接跳转到MVC。

#2


If you are going to use Classic ASP.NET Web Forms, you really need to learn how it works to avoid truely ugly html. If you know what you are doing, you can get close to what you want (you can't completely get rid of ViewState & it will do some ugly thing with element IDs)

如果您打算使用经典ASP.NET Web窗体,您真的需要了解它是如何工作的,以避免真正丑陋的HTML。如果你知道自己在做什么,你可以接近你想要的东西(你不能完全摆脱ViewState,它会用元素ID做一些丑陋的事情)

A lot of the ugliness of Classic ASP.NET occures when people write web forms like they wrote VB 6 Windows applications.

当人们编写类似于编写VB 6 Windows应用程序的Web表单时,会发生很多经典ASP.NET的丑陋。

ASP.NET MVC is a good option. It may be the way to go as a starting point; I would like to switch to it myself. I guess my point is that you can get less ugly HTML using Classic ASP.NET.

ASP.NET MVC是一个不错的选择。这可能是一个出发点的方式;我想自己切换到它。我想我的观点是你可以使用Classic ASP.NET获得不那么难看的HTML。

#3


you're really going to want to check out the asp.net mvc. it allows you to develop in a manner a lot more suited for the web than vanilla webforms.

你真的想要查看asp.net mvc。它允许您以比香草网格更适合网络的方式进行开发。

#4


First of all, ASP.Net, even using webforms, does allow you to have complete control over the markup output. Of course it's easier for some cases than others, but anywhere you find you're not getting the html you want out of a control you can always replace the render behavior with a ControlAdapter.

首先,即使使用webforms,ASP.Net也允许您完全控制标记输出。当然,对于某些情况来说,它比其他情况更容易,但是如果您发现自己没有从控件中获取所需的html,则可以始终使用ControlAdapter替换渲染行为。

That said, as others have mentioned you'll probably find it's much easier to get the exact html markup you want using ASP.Net MVC.

也就是说,正如其他人所说,你可能会发现使用ASP.Net MVC获得你想要的确切html标记要容易得多。

#5


MVC.net and WebForms are built upon ASP.net

MVC.net和WebForms建立在ASP.net之上

You can get a decent amount of control with webforms by disabling viewstate and not using any controllers (or very few). Its all in how much you let it do for you

通过禁用viewstate而不使用任何控制器(或很少),您可以通过webforms获得适当的控制。这就是你让它为你做多少

#6


If you are looking to acquire skills in the latest and greatest, then MVC is where you should start but I would also consider whether you will ever be asked to support ASP.Net Webforms. Having an understanding of ViewState is crucial to that end.

如果您希望获得最新和最好的技能,那么MVC就是您应该开始的地方,但我也会考虑是否会要求您支持ASP.Net Webforms。了解ViewState对此至关重要。

For fine grained HTML output, you can produce this in many different ways with classic ASP.Net. There is a growing group of developers who are using a mixture of ASP.Net and microtemplating with Javascript to produce RIA's. This inevitably leads to keeping your html output cleaner so that it can be manipulated with jQuery and CSS.

对于细粒度的HTML输出,您可以使用传统的ASP.Net以多种不同的方式生成它。有越来越多的开发人员使用ASP.Net和微软模板与Javascript混合生成RIA。这不可避免地导致您的html输出更加清晰,以便可以使用jQuery和CSS进行操作。

#7


Learn ASP.NET MVC as it will give you more control over the html generated. Also learning ASP.NET will increase your job opportunities significantly.

学习ASP.NET MVC,因为它可以让你更好地控制生成的html。学习ASP.NET也会大大增加你的工作机会。

#8


My first real development in ASP.NET was with MVC, and I must say I truly miss it now that I'm onto the next project using webforms. Each has it's place and webforms is working pretty well for what I'm doing (also using it as an opportunity to learn about TableAdapters and what not) but I really do miss being able to insert the data I need right into the HTML. That way I know the layout I've built won't get screwed up.

我在ASP.NET中的第一个真正的开发是使用MVC,我必须说我现在真的很想念它,因为我正在使用webforms进入下一个项目。每个都有它的位置和webforms在我正在做的事情上工作得很好(也使用它作为了解TableAdapters的机会,但是我真的很想错过能够将我需要的数据插入到HTML中。这样我知道我建立的布局不会搞砸了。

As a framework I enjoy ASP.NET quite a bit, but the controls on the page seems so far removed from anything resembling HTML that there is often a mental disconnect with what I'm typing with what I'm expecting to see. I was that way when I first started HTML though, so I imagine I'll get used to it. When I started with MVC it was overall a much more enjoyable experience coming from a front-end background.

作为一个框架,我非常喜欢ASP.NET,但是页面上的控件似乎远离了类似于HTML的东西,以至于我正在用我期待看到的内容进行精神上的断开。当我第一次启动HTML时,我就是那样,所以我想我会习惯它。当我开始使用MVC时,从前端背景来看总体上是一种更愉快的体验。