且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在运行时创建URL ..

更新时间:2023-12-06 15:06:10

这项技术被称为url重写,如果你谷歌搜索asp.net url rewriting之类的东西网址中的问题你会找到例子。如果您正在使用MVC,那么您可以更轻松地使用路由将问题令牌添加为操作的参数,然后您只需将其转换为某种类型的问题ID。



http://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/asp-net-mvc-routing-overview-cs [ ^

I want to create a Question Answer website , like in all website like ***.com, codeproject.com, Urls in the browser for every question-answers are different. So i just need a demo sample/code of that.

The technique is called "url rewriting", if you google for something like "asp.net url rewriting question in url" you'll find examples. If you're using MVC then it's easier as you can employ routing to add the question token as a param to the action, which you then just need to convert into a question id of some sort.

http://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/asp-net-mvc-routing-overview-cs[^]