How can I generate a webpage based on users request? for example, If someone wants to visit "www.mywebsite.com/example" and there is no such url, My website will generate him/her a webpage based on word "example". How can I do it? (I'm developing my website by ASP.NET)
Asked
Active
Viewed 40 times
0
-
Have you considered using ASP.NET MVC, or are you limited to Web Forms? – John Saunders Jun 18 '15 at 22:05
-
I am limited to Web Forms. – Amir Jun 18 '15 at 22:06
-
You may want to look at http://stackoverflow.com/tags/asp.net-routing/info. – John Saunders Jun 18 '15 at 22:08
-
Thank you so much @JohnSaunders – Amir Jun 18 '15 at 22:13
1 Answers
-1
One way to process such a page is to use ASP.NET attribute routing.
[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();
}
for webforms check: https://msdn.microsoft.com/en-us/library/cc668177(v=vs.140).aspx

Benjishk
- 51
- 1
- 3
-
-
@sushil it is MVC, you can set the attribute routing for webforms as follow, but i haven't use webforms in the past 3 years. so i won't be able to comment. please check the following link [link to Microsoft routing page](https://msdn.microsoft.com/en-us/library/cc668177(v=vs.140).aspx) – Benjishk Jun 18 '15 at 22:08
-