2 Replies - 5727 Views - Last Post: 20 August 2013 - 05:33 AM

#1 sadeq.hatami@yahoo.com  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-August 13

question for remove part of url

Posted 19 August 2013 - 07:50 AM

hello,

i wanna remove part of url
my default url is
http://localhost:154...Pages/Home.aspx

i want remove "/Store/Pages/" and ".aspx" extention from url in any page
for example in product page, i want my url from
http://localhost:154...es/Product.aspx
convert to
http://localhost:1549/Product

i read any link and sample and website,
but i can't solved this problem
in c# my code is:
    public class Global : System.Web.HttpApplication
    {

      protected  void Application_Start(object sender, EventArgs e)
        {
            RegisterRoute(RouteTable.Routes);
        }

      private void RegisterRoute(RouteCollection routeCollection)
      {
          routeCollection.MapPageRoute("General Routing", "Store/Pages/{HomeName}", "~/Store/Pages/Home.aspx");
      }
    }


but not work
please help me for this code
thank's

Is This A Good Question/Topic? 0
  • +

Replies To: question for remove part of url

#2 olibenu  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 537
  • Joined: 31-December 08

Re: question for remove part of url

Posted 19 August 2013 - 11:42 PM

if this was apache, i'd say htaccess
Was This Post Helpful? 0
  • +
  • -

#3 Nakor  Icon User is offline

  • Professional Lurker
  • member icon

Reputation: 444
  • View blog
  • Posts: 1,492
  • Joined: 28-April 09

Re: question for remove part of url

Posted 20 August 2013 - 05:33 AM

Try something like
routes.MapPageRoute("",
        "{controller}/{action}/{page}",
        "~/categoriespage.aspx",
        true,
        new RouteValueDictionary 
            {{"controller", "Store"}, {"action", "Pages"}, {"page", "home"});


I've never really worked with routes in webforms but from what I've read that looks pretty close.

http://msdn.microsof...y/cc668201.ASPX
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1