Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 15-Jan-13 23:20pm
074051.1K
Edited 13-Jun-13 0:31am
v6
Comments
Sandeep Mewara at 16-Jan-13 8:49am
   
You tried and what? Where exactly you need help?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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

Please let us know if Routing worked for you

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can use the following function in your Global.asax file
 
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
  Permalink  
Comments
07405 at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 13 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100