Ticket T406218
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

How to provide short and user-friendly URLs for XAF Web Views

How to change the default URL format in XAF Web apps

created 9 years ago

Hello,

I want to change the url when the end-user is navigating .
Sample:

The URL when any user is navigating = http://localhost:2064/default.aspx#ViewID=EnviarPedidoWeb_ListView&ObjectClassName=VendasWeb.Module.BusinessObjects.PedidoWeb

I want to change for : http://localhost:2064/default.aspx (generic) or   http://localhost:2064/EnviarPedido (or for page)…

How I make this?

Comments (3)
DevExpress Support Team 9 years ago

    Processing detail views requires more complex logic because their URLs include additional parameters (the current ObjectKey, ViewEditMode, etc.). You should examine all items of the ViewShortcut (it is a regular dictionary) passed in the GetQueryString method and decide how to translate them to a custom URL. Then, implement the reverse transformation in the GetViewShortcut method. The exact solution depends on your requirements.

      Thank you Michael,
      I did function GetQueryString to return blank always…
      For this project it's sufficient …

      DevExpress Support Team 9 years ago

        You're welcome. Should you have additional questions, please let me know.

        Answers approved by DevExpress Support

        created 6 years ago

        Hello,
        We've simplified URL customization for ListViews and DetailViews in Web apps with the new RouteManager API in v19.1. For example, you can now customize URLs to match the following highly requested format:
        BEFORE:
        */Default.aspx#ViewID=Contact_ListView
        */Default.aspx#ViewID=Contact_DetailView&ObjectKey=ContactId
        AFTER:
        */Contact_ListView/
        */Contact_DetailView/ContactId/
        To make sure that our future implementation meets your business requirements, we would greatly appreciate it if you test our early access preview version. Read this knowledge base article to learn more about this new capability.

        Thank you for your time and cooperation,
        Arkady

          Other Answers

          created 9 years ago (modified 6 years ago)

          Hello Nathan.

          While we don't provide a solution to completely remove he fragment identifier from the URL or to replace the page name with something else, you can change the representation of the ViewShortcut in the URL (the fragment identifier part). For this, create a DefaultHttpRequestManager descendant and override the GetQueryString and GetViewShortcut methods. To use a custom request manager, override the WebApplication.CreateHttpRequestManager method, create the custom request manager instance, and return it. Refer to the How to provide short and user-friendly URLs for XAF Web Views ticket.

          Attached is an example demonstrating a possible solution to replace URLs for some predefined views. Feel free to extend it with more sophisticated logic according to your requirements.

            Comments (3)

              Hello Michael,

              I tried to convert the VB to C# code but I can't to make.
              Do you can to provide a converted example for me?

              DevExpress Support Team 9 years ago

                We don't have a ready C# example at the moment, because the VB project posted in that ticket was provided by the customer. We need additional time to create a C# example. I will update this thread once we have any result.

                At the moment you can find some freely available VB to C# converters on the Internet.

                DevExpress Support Team 9 years ago

                  I have created a simplified example that demonstrates how a custom request manager can be implemented to change view URLs. It is attached to my answer.
                  Let me know if you have additional questions.

                  Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                  Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.