简体   繁体   English

根据URL将内容从DB加载到aspx页面

[英]Loading content from DB to aspx page based on URL

I'm currently trying to create a small scale CMS for my personal website and thought I'd like to try to make some sort of a page layout from a basic aspx file with some placeholders and load content based on the URL, without the use of url query strings such as ?pageid=1 . 我正在尝试为我的个人网站创建一个小规模的CMS,并且我想我尝试从基本的aspx文件中创建一些page layout ,其中包含一些占位符并根据URL加载内容,而不使用url查询字符串,例如?pageid=1

I'm trying to wrap my head around how this can be achieved without getting errors of a physical file not existing when I eg type in http://mywebsite.com/projects/w8apps/clock . 我试图解决如何实现这一点,而不会在我输入http://mywebsite.com/projects/w8apps/clock时出现物理文件不存在的错误。

I've read a lot about BLOB and storing files binarily in the database. 我已经阅读了很多关于BLOB和在数据库中二进制存储文件的内容。 But I haven't come across a blog which points in the direction of using a so called page layout and loading content based on the URL instead of a query string. 但我没有遇到一个博客指向使用所谓的page layout并基于URL而不是查询字符串加载内容。

I'm not asking for a solution, just some hints - blogs mostly - which can point me in the right direction and help me achieve this goal. 我不是要求一个解决方案,只是一些提示 - 主要是博客 - 这可以指出我正确的方向并帮助我实现这一目标。

To deal with loading a page with a URL that is more friendly, rather than ?page_id=1, you may want to have a look at this article about URL Rewriting and URL Mapping. 要处理使用更友好的URL加载页面而不是?page_id = 1,您可能需要查看有关URL重写和URL映射的文章。

http://www.codeproject.com/Articles/18318/URL-Mapping-URL-Rewriting-Search-Engine-Friendly-U http://www.codeproject.com/Articles/18318/URL-Mapping-URL-Rewriting-Search-Engine-Friendly-U

Hope you can find a way of fitting this kind of code into your application! 希望您能找到一种方法将这种代码融入您的应用程序中!

You questions is too broad but here are couple hints that will point you in the right direction. 你的问题太宽泛了,但这里有几个提示会指出你正确的方向。

  • Create clear specs before you start working on this. 在开始处理之前创建清晰的规范。 Do you really need to have URLs like this http://mywebsite.com/projects/w8apps/clock ? 你真的需要这样的网址http://mywebsite.com/projects/w8apps/clock吗? If yes then check out MVC since it has best support for this 如果是,那么请查看MVC,因为它对此有最好的支持

  • Storing binary files in database doesn't have much to do with this. 在数据库中存储二进制文件与此无关。 You first need to think of how your tables will look like and that is based on what are you trying to achieve… 您首先需要考虑表格的外观,这取决于您要实现的目标......

I'd suggest you install some CRM that if open source and analyze this first. 我建议您安装一些CRM,如果是开源的并首先进行分析。 You'll probably find a lot better ideas this way. 你可能会用这种方式找到更好的想法。 Just go to CodePlex and search for CMS. 只需转到CodePlex并搜索CMS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM