如何在每日报价网站中使用 ASP.NET 路由

发布于 2024-08-29 05:32:31 字数 412 浏览 5 评论 0原文

下午好,

一位客户有兴趣创建一个 ASP.NET 2.0 网站,其目的是提供“每日报价”。他希望静态内容页面上的引号全部附加到同一母版页。报价页面必须按一定的顺序查看,并且站点浏览器在浏览站点时不能查看除起始页面之外的任何其他页面。即大家进入站点时必须进入001.aspx页面。

两个问题: 1. 内容页面将由客户端使用 Excel 数据源和创建每个报价页面的合并过程来创建,例如。 001.aspx、002.aspx 等。这对我来说充其量是笨重的。 ASP.NET 动态数据会是更好的解决方案吗?

  1. 我对 ASP.NET 路由和 URL 重写整体来说还是个新手。如何设置路由表以确保用户始终在同一入口页面上输入站点,并创建路由表以使 default.aspx 解析为 001.aspx?

谢谢, 席德

Good Afternoon,

A client is interested in creating an ASP.NET 2.0 website whose purpose is to serve up a "quote of the day". He wants the quotes on static content pages all attached to the same master page. The quote pages must be viewed in a certain sequence, and site browsers cannot view any other pages than the starting page when browsing to the site. That is, everyone must go to page 001.aspx when entering the site.

Two Questions:
1. The content pages are going to be created by the client using an excel data source and a merge process by which each quote page is created eg. 001.aspx, 002.aspx etc. This seems clunky to me at best. Would ASP.NET Dynamic Data be a better solution here?

  1. I'm new to ASP.NET Routing and URL Rewriting as a whole. How would I setup a route table to ensure that users always entered the site on the same entry page, and create a route table such that default.aspx resolves to 001.aspx?

Thanks,
Sid

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

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

发布评论

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

评论(1

幻想少年梦 2024-09-05 05:32:31

我建议使用 Excel 工作表作为数据源,并通过分页从所述数据源获得的结果集来处理查看“报价页面”。


如果您的客户关心 SEO,他必须认识到,他对只有一个入口页面的要求违背了他的“一引用一页是 SEO 友好”的原则。

我认为区分人类用户和搜索机器人的努力不值得。

无论如何,googlebot 能够使用 URL 参数对页面进行索引,从而在不生成静态内容的情况下实现 SEO 友好(其他机器人也应该如此)。


可能的解决方案

为了允许搜索机器人为您的报价建立索引,您需要一个报价日期的查询参数。

如果您想强制人类用户(黑客不算;-))仅在当前日期之前进入网站,您可以检查浏览器字符串,并将任何不被识别为搜索机器人的浏览器重定向到当前日期(如果引荐来源网址是)不等于前一个日期。

这个解决方案应该会给你一个合理的结果,而不需要太多的开销。

I would suggest to use the excel sheet as a data source and handle viewing the 'Quote pages' by paging through the result set obtained from said data source.


If your client is concerned about SEO, he must recognize that his requirement to have only one entry page defeats his One-Quote-One-Page-Is-SEO-friendly.

I don't think the effort to distinguish between a human user and a search bot is worth it.

Anyway googlebot is capable of indexing pages with URL parameters thus allowing to be SEO friendly without generating static content (other bots should be as well).


Possible solution

To allow search bots to index your Quotes you have a query parameter for the date of the Quote.

If you want to enforce human users (hackers don't count ;-)) to enter the site only by the current date you check the browser string and redirect any browser not being know as a search bot to the current date if the referer is not equal to the previous date.

This solution should give you a reasonable result without too much overhead.

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