I just added routing in my new asp.net 4 web form application and found that my route table is configured fine and page requests are working fine.
Now I want to use the Page.GetRouteUrl method whenever I need to create one of my friendly URLs. I started to implement this on different pages, then I thought that I could shorten the code a little if I had a method in one of my own helper classes that builds this URL (using the Page.GetRouteUrl method), since I can There are several parameters that need to be specified each time against the Page.GetRouteUrl method.
However, in my helper class, he does not know what a Page is. I thought I could go to the Page page from a page that wants to create a routable url, but in some cases I want to build one of these Url in another class that does not know what the Page is, and this script doesnβt will be able to pass it as a parameter (and therefore will not be able to use Page.GetRouteUrl in my helper class).
What is the normal approach when you want to use Page.GetRouteUrl in classes that don't have an instance of the Page object? <?
source
share