Developer forum

Forum » Development » Custom URL Provider

Custom URL Provider

Anders Ditlevsen
Anders Ditlevsen
Reply

Hi, i am messing around with making a custom URL provider.

I have read the PDF about making custom url providers and have made this so far:

 [AddInName("Image Alias Redirect"), AddInDescription("alias to image name redirect mapper"), AddInActive(true), AddInAuthor("test A/S"), AddInGroup("test")]
  public class CustomUrlProvider : UrlProvider
  {
    public override List<Mapping> GetMappings()
    {
      List<Mapping> mappings = new List<Mapping>();

      mappings = GetAliasImageMapping(mappings);

      return mappings;
    }

    public List<Mapping> GetAliasImageMapping( List<Mapping> mappings )
    {
      // Some worker class that fetches a list of mappings
      Mapping testMap = new Mapping("test", "test", "rewrittentest");
      mappings.Add(testMap);

      return mappings;
    }
  }

So far i am able to make it activate on somewebsite.local/Default.aspx?test=test. However i seem to be unable to have it activate on for instance products.aspx, getImage or just in general.

The way i understood it, the custom url provider just maps what params and corresponding values must be rewritten to some other url. In the provder you cannot specify if it should activate off of default.aspx or whatever comes before the first set of params.

So does it only work off of default.aspx ? ,or have i misunderstood something because i cannot seem to make it rewrite a url with test=test unless default.aspx comes before the params.


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Anders

Yes, it only works for URLs going through the pageview instance - that would be Default.aspx.

You cannot rewrite for GetImage.asxh if that is what you are trying?

What do you want to achieve - and why? Maybe there is another way.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum