Current filter:
                                You should refresh the page.
                                  • Looking at a xaf web app, and click any menu item, and you rewarded with a huge url, directly naming the view AND the business namespace of the BO. WHY? This seems like a carry-over from early days of prototyping xaf. Clients need not see this. Surely we can databaze-ize the static urls, perhaps provide a friendly url text and do a lookup each time? Shove it into an in-memory cache to not impact naviagtion, but surely this has been discussed internally?

                                    thanks for listening.

                                2 Solutions

                                Creation Date Importance Sort by

                                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.

                                If you have any feedback on this new capability, feel free to post a comment to the T725330 ticket.

                                 

                                Thank you for your time and cooperation,
                                Arkady

                                • Santiago Moscoso 03.19.2019
                                  Could you make it configurable for each view by Model (and maybe an attribute)?


                                  Also for default views, could you remove the _ListView and _DetailView suffix?

                                  Following the before, can you provide a convention for variant views, let's say for Contact_ListView_Varied to have the URL Contact/Varied

                                  Does it accept the value of the FriendlyKey for the ObjectKey?
                                • Gosha (DevExpress Support) 03.19.2019

                                  Hello Santiago,

                                  I've created a separate ticket on your behalf (T725330: Web - Suggestions for User-Friendly URLs for Views).

                                UPDATED by Dennis (DevExpress Support):
                                To simplify your current solution, we have provided two overridable methods in the built-in DevExpress.ExpressApp.Web.DefaultHttpRequestManager class starting with v15.1.8+:

                                  public virtual string GetQueryString(ViewShortcut viewShortcut) { ... }
                                  public virtual ViewShortcut GetViewShortcut(string queryString) { ... }

                                That means that in the simplest case it would be sufficient to inherit from DefaultHttpRequestManager and override these two methods (no need to re-implement IHttpRequestManager from scratch) that will help you cut the amount of code written in FriendlyUrlHttpRequestManager in several times. As before, you will be able to supply a custom DefaultHttpRequestManager descendant in the overridden CreateHttpRequestManager method of the WebApplication descendant. You can find a  ready sample in the T406218 ticket.
                                =========================

                                I have been mining in the source code to find where could I change the URL creation behavior.

                                 

                                The way I followed was to create a descendant from DefaultHttpRequestManager and override WriteShortcutTo and GetViewShortcutFromQueryString.

                                 

                                I couldn't get rid of the # symbol, because that implied modifying some javascript files, but still I got urls that are quite a lot cleaner.

                                 

                                Attached is the sample project. (I work on VB.NET, sorry no C# version)

                                 

                                Highlights:

                                 

                                Include ModelExtenders\IModelClassFriendlyUrl.vb in the platform-agnostic module project.

                                Include Utils\FriendlyUrlHelper.vb in the platform-agnostic module project.

                                Include FriendlyUrlHttpRequestManager.vb in the WebApplication project.

                                 

                                Copy this inside the platform-agnostic module class

                                [VB.NET]
                                Public Overrides Sub ExtendModelInterfaces(extenders As Model.ModelInterfaceExtenders) MyBase.ExtendModelInterfaces(extenders) extenders.Add(Of Model.IModelBOModel, ModelExtenders.IModelBOModelFriendlyUrls)() extenders.Add(Of Model.IModelClass, ModelExtenders.IModelClassFriendlyUrl)() extenders.Add(Of Model.IModelView, ModelExtenders.IModelViewFriendlyUrl)() extenders.Add(Of Model.IModelDetailView, ModelExtenders.IModelDetailViewFriendlyUrl)() extenders.Add(Of Model.IModelListView, ModelExtenders.IModelListViewFriendlyUrl)() extenders.Add(Of Model.IModelDashboardView, ModelExtenders.IModelDashboardViewFriendlyUrl)() End Sub

                                 

                                Copy this inside the WebApplication class

                                [VB.NET]
                                Protected Overrides Function CreateHttpRequestManager() As IHttpRequestManager Return New FriendlyUrlHttpRequestManager() End Function

                                 

                                Optionally (but recomended) change the FriendlyUrl property of a class (or DC) from the model or apply the new FriendlyUrlAttribute

                                 

                                Optionally (but recomended) change the FriendlyKeyPropertyName of a class (or DC) from the model or applying FriendlyKeyPropertyNameAttribute included in the framework

                                 

                                Friendly List URL:

                                ~/DefaultVertical.aspx#user=list

                                Old List URL:

                                ~/DefaultVertical.aspx#ShortcutViewID=SecuritySimpleUser_ListView&ShortcutObjectClassName=DevExpress.ExpressApp.Security.SecuritySimpleUser

                                 

                                Friendly Detail URL:

                                ~/DefaultVertical.aspx#user=DOMAINNAME\username

                                Old Detail URL:

                                ~/DefaultVertical.aspx#ShortcutViewID=SecuritySimpleUser_DetailView&ShortcutObjectKey=4868e72d-e7ea-4844-93f9-77e960697804&ShortcutObjectClassName=DevExpress.ExpressApp.Security.SecuritySimpleUser&Shortcutmode=View

                                 

                                Note:

                                I've just taken this from the oven, it's still hot. I havent thoroughly tested it yet, so I could be a little buggy.

                                I'll appreciate any feedback.

                                Show all comments
                                • Dennis (DevExpress Support) 07.24.2012

                                  Thank you for posting your solution here, Santiago. We highly appreciate it.
                                  Santiago, it is probably worth it to you and the rest of the community to make your solution part of the eXpand Framework.

                                  This way, you will receive more feedback and eventually get a higher quality product. At once, the community will get an easy to use reusable module. Please send an email to contributors@expandframework.com for more details.

                                • Apostolis Bekiaris (DevExpress) 08.16.2012

                                  Thanks for this contribution Santiago! From version 12.1.5.17 a c# version of this code will be available with expandframework. The source code files can be obtained from github http://goo.gl/tPIaJ.. A related discussion can be found at http://goo.gl/4OYZc

                                • drew.. 06.13.2013

                                  hey Apostolis.. i think the friendly url topic might finally get me into expand ;) .. a current contract of mine requires a public link into a secured app and the url is not very friendly..

                                • Mario Funke 03.12.2014
                                • Farooq 06.20.2014

                                  Hi there,

                                  First of all, thanks to Santiago Moscoso for putting a great effort in addressing one of the most common issues of XAF.

                                  I have downloaded the sample application but it is not compiling due to lot of errors. I am using DevExpress Version 14.1.3.

                                  Does the code works on v14.1.3?

                                • Santiago Moscoso 06.23.2014

                                  Hello there,

                                  Attached is an updated version of the request manager, fixed some bugs.

                                • Anatol (DevExpress Support) 02.10.2015

                                  Thank you for your update. I have attached a complete example for version 14.2. I have removed some code from your SuiteHttpRequestManager class, which I believe is not relevant to the example.

                                • Santiago Moscoso 02.10.2015

                                  Nice.
                                  I forgot to remove that when uploading the example =P

                                • Zackahriah Jones 02.17.2015

                                  Santiago,
                                  Thank you so much for contributing this to the community!  This is an awesome solution to an issue that we have been experiencing as well.

                                  I feel like I am 99% of the way there; we're just running into one more snag within my v13.2.9 project, and I was hoping that you could assist us!

                                  I am able to see the URL with the correct FriendlyUrl property (the AccountName value in this case), but when we attempt to navigate directly to the same URL, it shows that it's expecting the OID/GUID of the object, and not the field that we selected.

                                  Is there an easy way that you have encountered to either navigate using a different value than the key property, or to look that key property up on the fly?  I feel like I could just use XPQuery to look up the OID based on the given query parameter, but I'm not sure that is the best way to go about it... especially if that is already baked into the FriendlyURL code and I'm just missing it. :)

                                  I attached a sample project (using the XCRM demo as a base and adding the FriendlyUrl code to it), as well as a few screenshots to try and better convey what I'm looking for.  Let me know if I can clarify anything, or if I'm just way out in left field with this question.

                                  Thanks much!

                                • Santiago Moscoso 02.19.2015

                                  Zachahriah,

                                  I found 3 issues (of wich the last 2 are actually my fault):

                                  1. There are 2 views with the same FriendlyUrl (IAccount_DetailView and ICRMAccount_DetailView) the code was picking the first. Sin ICRMAccount is an IAccount it could work if IAccount had the FriendlyKey set to AccountName, alternatively change the FriendlyUrl of IAccount to something else (like AccountBase or whatever). I'm not sure if there could be a better alternative to resolve conflicts. Also I recommend changing the FriendlyUrl at the BO level so both detail and list views use the same friendly url.

                                  2. I never really tested it with keys containing spaces or special characters. To fix it is needed to call UrlDecode on the the friendly object key value before looking for it with the ObjectSpace.

                                  3. The updated RequestManager I uploaded needs the actual view model not just its id, I made a slight change to the FriendlyUrlHelper to return the view instead of its id, but I forgot to upload the updated code to that file.

                                  I attach the updated code.

                                • Zackahriah Jones 03.16.2015

                                  Santiago,
                                  I just wanted to close the loop on this one.  I applied the changes you had uploaded/suggested, and also saw my faux pas with regard to the CRM example.  We did not have the same naming closeness in our actual project, so luckily that didn't come up.

                                  We were able to implement and test the solution successfully, and everything is working as expected.  We are able to navigate directly to the corresponding XPO field within the URL, without that field being an OID, which is exactly what we needed.

                                  Thank you again, to both you and Anatol, for your assistance with this solution!!

                                • Chris Royle (LOB) 05.29.2015

                                  Maybe something that can be included out of the box for the shiny new 15.1 Web UI ?

                                • Dennis (DevExpress Support) 10.05.2015

                                  @Santiago:
                                  To simplify your current solution, we have provided two overridable methods in the built-in DevExpress.ExpressApp.Web.DefaultHttpRequestManager class starting with v15.1.8+:

                                    public virtual string GetQueryString(ViewShortcut viewShortcut) { ... }
                                    public virtual ViewShortcut GetViewShortcut(string queryString) { ... }

                                  That means that in the simplest case it would be sufficient to inherit from DefaultHttpRequestManager and override these two methods (no need to re-implement IHttpRequestManager from scratch) that will help you cut the amount of code written in FriendlyUrlHttpRequestManager  in several times. As before, you will be able to supply a custom DefaultHttpRequestManager descendant in the overridden CreateHttpRequestManager method of the WebApplication descendant.
                                  I hope you find this update helpful and will also share a stripped-down solution version with the community once the new version is out.

                                • Santiago Moscoso 10.05.2015

                                  Excellent news, Dennis.

                                • Pauline Abou haidar 11.10.2016
                                  Dear Santiago Hi,

                                  I used your code to adjust the URLs in my project,and thank you!!!
                                  I have a question:
                                  I got this shortcut :
                                  http://localhost:4255/#/default.aspx#Quote=list

                                  How can i remove /default.aspx to have the url as:
                                  http://localhost:4255/#Quote=list

                                  ?

                                  Thank you
                                • Santiago Moscoso 11.10.2016
                                  Hi Pauline. I'm glad my solution helped you.

                                  Here I leave you a link to answer your question:
                                  https://forums.asp.net/t/1366144.aspx?How+to+set+up+Default+Page+in+IIS+

                                • Pauline Abou haidar 11.11.2016
                                  Thank you,
                                  I already defined the default page,my question was inside xaf code,how to define the shortcut to be directly:http://localhost:4255/#Quote=list (i want to remove the default.aspx from the url...)

                                  Anyway,i found a serious problem after adding the code:All the popups are appearing now as detailview,and the execute action is not executing(notification popup,lookup popup....) do you have any idea where the code is affecting this?

                                  Thank you again for your support
                                • Santiago Moscoso 11.16.2016
                                  Pauline,

                                  Could you provide some sample code?
                                • Pauline Abou haidar 11.16.2016
                                  Hi,

                                  Attached are the 2 classes that i added to my project:FriendlyUrlHelper.vb and SuiteHttpRequestManager.vb
                                  And in the module.vb i added this method:

                                  Public Overrides Sub ExtendModelInterfaces(extenders As Model.ModelInterfaceExtenders)
                                          MyBase.ExtendModelInterfaces(extenders)


                                          extenders.Add(Of Model.IModelBOModel, ModelExtenders.IModelBOModelFriendlyUrls)()
                                          extenders.Add(Of Model.IModelClass, ModelExtenders.IModelClassFriendlyUrl)()
                                          extenders.Add(Of Model.IModelView, ModelExtenders.IModelViewFriendlyUrl)()
                                          extenders.Add(Of Model.IModelDetailView, ModelExtenders.IModelDetailViewFriendlyUrl)()
                                          extenders.Add(Of Model.IModelListView, ModelExtenders.IModelListViewFriendlyUrl)()
                                          extenders.Add(Of Model.IModelDashboardView, ModelExtenders.IModelDashboardViewFriendlyUrl)()
                                      End Sub
                                • Santiago Moscoso 11.17.2016
                                  That doesn't show how you show the popup.
                                  Also wich version of DevExpress are you using?
                                • Pauline Abou haidar 11.18.2016
                                  I'm using dev express 16.1.5

                                  The popup is a popup action inside a view controller.I added the action normally to the view controller and the code on the execute event of the action.

                                  The popup is showing as a detailview with save,new,save and close.... and not as a normal popup with just an ok and cancel buttons.

                                  Attached are 2 pics:the correct one is when i stopped the code in web application.vb,the false one is when i called the method :
                                  Protected Overrides Function CreateHttpRequestManager() As IHttpRequestManager
                                          Return New SuiteHttpRequestManager()
                                      End Function

                                  I think the problem is on the methods:GetPopupWindowId() ,GetPopupWindowShowActionId(),etPopupWindowQueryString()
                                  But if i put this functions as comment to stop adding shortcut for the popups,i got an error that i should implement these methods...