如何根据用户请求生成网页?例如,如果有人想访问“www.mywebsite.com/example”并且没有这样的网址,我的网站将基于单词“example”生成他/她的网页。我该怎么做? (我正在通过ASP.NET开发我的网站)
答案 0 :(得分:-1)
处理此类页面的一种方法是使用ASP.NET属性路由。
[Route("{pageName}")]
public ActionResults myActionName(String pageName)
{
// in this action method you process what you need to do to
// figure out what you need to generate base to push to user.
//------
// either make a generic view and fill with your content or
// generate the view code on the fly.
// you can also send view to user from a DB.
return view();
}
用于webforms检查: https://msdn.microsoft.com/en-us/library/cc668177(v=vs.140).aspx