Click here to Skip to main content
15,891,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...

my site url would be like this www.test.com. if the user gives like www.test.com/questions. it should be redirected to some survey which contains questions. how can i impliment this. i need to get string from that url like questions.


in global.asax i added

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
       routes.MapPageRoute("route", "{Employee}", "~/Employee/test.aspx");


i am still facing this problem, help me in this aspect...


Thanks in advance..
Posted
Updated 13-Jun-13 0:31am
v6
Comments
Sandeep Mewara 16-Jan-13 8:49am    
You tried and what? Where exactly you need help?

URL Patterns for the Routing should help you, and even you could use HttpModules

Please let us know if Routing worked for you

 
Share this answer
 
You can use the following function in your Global.asax file

C#
private static void RegisterRoutes(RouteCollection routes)
      {
         routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
         //routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

         routes.MapRoute(
             "Default", // Route name
             "{controller}/{action}/{id}", // URL with parameters
             new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
         );
      }



and initialize the function in your Application_Start Event.

Hope this will work
 
Share this answer
 
Comments
07405 16-Jan-13 23:51pm    
Thanks for ur reply...
my project does not contain folder. by giving url like this www.test.com/questions it should be redirected to questions page. if the url is like this www.test.com/doctor it should be redirected to doctors page... based on the last string it should be redirected. in this way users can search whatever word they want. help me in this aspect..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900