Results 1 to 3 of 3

Thread: Routes dont work, its only show the real page name in link

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    48

    Routes dont work, its only show the real page name in link

    Hi

    Im looking on some routes.MapPageRoutes but i cant get it to work.

    I have these link
    ROOT
    default..aspx
    brands.aspx
    service.aspx
    contact.aspx
    aboutus.aspx
    shopping.aspx
    ALL these pages is running with a masterpage
    eb.master (also in the root)

    And then i have the global file that have the namespace in the global file also.

    when im running the pages/website and i have the default.aspx page activ, it show
    www.mydomain.dk/default.aspx
    when i wanted it to be
    www.mydomain.dk/Butikken

    Its the same problem with the others routes, can someone help me !?

    Code:
    <%@ Application Language="VB" %>
    <%@ Import Namespace="System.Web.Routing" %> 
    
    <script runat="server">
    
        Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs on application startup
            
            '///// Denne linje er den der kalder Sub'en RegisterRoutes ved opstart, er meget vigtig. /////
            RegisterRoutes(RouteTable.Routes)
        End Sub
        
        Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs on application shutdown
        End Sub
            
        Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs when an unhandled error occurs
        End Sub
    
        Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs when a new session is started
        End Sub
    
        Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs when a session ends. 
            ' Note: The Session_End event is raised only when the sessionstate mode
            ' is set to InProc in the Web.config file. If session mode is set to StateServer 
            ' or SQLServer, the event is not raised.
        End Sub
        
        '///// Dette Sub er vigtig i Routes, sammen med import namespace System.Web.Routing. /////
        Sub RegisterRoutes(ByVal routes As RouteCollection)
            'for de forskellige link adresses/ruter skal der laven en 
            routes.MapPageRoute("", _
                                "Butikken", _
                                "~/default.aspx")
            ' adresse nr. 2
            routes.MapPageRoute("", _
                                "Brands", _
                                "~/brands.aspx")
            ' adresse nr. 3
            routes.MapPageRoute("", _
                                "Kontakt", _
                                "~/contact.aspx")
            ' adresse nr. 4
            routes.MapPageRoute("", _
                                "VoresService", _
                                "~/service.aspx")
            ' adresse nr. 5
            routes.MapPageRoute("", _
                                "OmOs", _
                                "~/aboutus.aspx")
            
            ' adresse nr. 6
            routes.MapPageRoute("", _
                                "OnlineButik", _
                                "~/shopping.aspx")
       
        End Sub
           
    </script>

  2. #2

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    48

    Re: Routes dont work, its only show the real page name in link

    just some info.

    If i have a link to "Butikken" then it works, it show www.mydomain.dk/Butikken (Real link www.mydomain.dk/default.aspx)

    But first time loading the page as www.mydomain.dk then it show www.mydomain.dk/default.aspx and then my websitemap menu is not working, its not showing the css for selected/activ page/link for www.mydomain.dk/default.aspx

    If i then click my logo or a link to "Butikken" then it refresh the page and show the www.mydomain.dk/Butikken and then my websitemap menu is working just fine.

    How do i fix this "error" when users at visiting my site first time !?

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Routes dont work, its only show the real page name in link

    Hello,

    If you haven't already done so, I would suggest that you take a look at this:

    http://www.asp.net/web-forms/videos/...pnet-web-forms

    Hope that helps!

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width