向 ASP.NET 添加简单的服务器端脚本

发布于 2024-07-24 07:52:57 字数 425 浏览 10 评论 0原文

我需要一个简单的服务器端脚本解决方案来解决以下问题: 我的客户让我用 ASP.NET MVC 制作一个网站。 我正在对整个网站进行编码,但他们希望以后能够通过简单的脚本编写来扩展一部分。 例如:

你的生日是什么时候?
__/__/____  [x] 不显示年份

这需要一个标题(你的生日是什么时候?)、日期、指示需要复选框的方式以及复选框的文本。 这就是所有简单的标记。 最后一个需求是是否显示出生年份的条件。 稍后显示此信息时。

我考虑使用 JavaScript 作为我的脚本语言,并在客户端运行它。 尽管这适用于上面的简单示例,但一些现实世界的信息过于敏感,无法像在 JavaScript 中那样轻松查看。 我宁愿所有数据都在服务器端处理。

I need a simple server-side scripting solution for the following problem:
My client has me making a site in ASP.NET MVC. I'm coding the whole site but there's a section they want to be able to expand later via simple scripting. For example:

When is your birthday?
__/__/____  [x] Don't display the year

This needs to take a title (When is your Birthday?), a date, a way to indicate that a checkbox is needed, and a text for the checkbox. That's all simple markup. The final need is a conditional for whether or not to display the birth year. When displaying this information later.

I considered using JavaScript as my scripting language and just running it client-side. Although this works for the trivial example above, some of the real-world information is too sensitive to have so easily seen as can be done in JavaScript. I'd rather all the data be processed server-side.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风渺 2024-07-31 07:52:57

如果您的客户有足够聪明的人可以使用 JavaScript 来完成此操作,那么为什么那个人不能学习足够的 C#(或 VB.NET?)来直接编辑视图和控制器呢?

使用某些嵌入式脚本语言或插件架构的额外复杂性来构建您的应用程序似乎有些过分,并且可能会让那些了解 C# 并根据需要进行这些简单更改的人来维护它。

我想说 C# 或 VB.NET 是非常好的服务器端语言,那么为什么还要寻找其他语言呢?

If your client has someone smart enough to do this with JavaScript, then why couldn't that person learn enough C# (or VB.NET?) to simply edit the views and controllers directly?

Building your app with the extra complexity of some embedded scripting language or plugin architecture seems like overkill and would probably make it harder to maintain by someone who did know C# and came along to make these simple changes as needed.

I'm trying to say that C# or VB.NET are pretty good server side languages, so why look for something else?

累赘 2024-07-31 07:52:57

我赞同 Dennis 的回答,并补充说他们可能会考虑将 SharePoint (WSS 3.0) 用于网站的该部分。 它是基于 ASP.NET 和 Windows Workflow Foundation 构建的,因此它不是什么外国技术。

另一方面,它是为了由很少或没有编程背景的人扩展而构建的。 可以使用 SharePoint UI 或使用现已免费的 Microsoft Office SharePoint Designer 进行修改。

这对他们来说应该绰绰有余,而且不必过度概括您的网站以适应模糊的要求。

I'd echo Dennis' answer, and add that they might want to consider using SharePoint (WSS 3.0) for that part of the web site. It's built on ASP.NET and Windows Workflow Foundation, so it's not some foreign technology.

On the other hand, it's built to be extended by persons with little or no programming background. Modifications can be made using the SharePoint UI, or using Microsoft Office SharePoint Designer, which is now free.

That should be more than enough power for them, and all without having to over-generalize your site in order to accommodate vague requirements.

信愁 2024-07-31 07:52:57

它的定义已经足够了,您可能不需要像 sharepoint 或 WWF 这样极其复杂的东西,只需要一点 object-foo 即可。 根据您对需求的描述,您需要:

1)存储这些“DateOptionFields”的设施,这些“DateOptionFields”可能可以追溯到用户记录。 同样,根据您对问题的描述,您正在查看 6 个左右字段:QuestionType、QuestionTitle、CheckedTrue、DateSupplied 和 ShouldShowYear 以及一些标识符。

2) 管理这些额外问题的设施——实际上取决于应用程序和要求。 如果“额外”问题不适用于所有用户,则会变得有点粘性,但通常不会太粘性。

然后将“额外”问题插入 UI 中适当的位置,供适当的用户使用,这样就完成了。

That is defined enough that you probably don't need hideously complex stuff like sharepoint or WWF, just a little object-foo. From your description of the requirements you'd need:

1) Facilities to store these "DateOptionFields" which could presumably track back to a user record. Again, from your description of the problem, you are looking at 6 or so fields: QuestionType, QuestionTitle, CheckedTrue, DateSupplied and ShouldShowYear as well as some identifier.

2) Facilities to manage these extra questions--really depends on the app and the requirements. Gets a bit stickier if the "extra" questions don't apply to all users, but generally not too sticky.

Then jack the "extra" questions into the UI at appropriate places for appropriate users and you are done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文