Disabling image path rebasing

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DamienS

    Disabling image path rebasing

    Hi,

    I'm wondering if there's a way to prevent ASP.Net from rebasing the
    URLs/Paths in my Images.

    My website is using a reasonably complex system to perform skinning
    (custom code combined with out of the box ASP themes). The problem is
    that whenever I add an image (either Image or HtmlImage), ASP is
    overwriting my URL with it's version. I need the URL to be fixed to
    http://mysite/images/xyz.jpg.

    I've managed to get it going by using a literal control, however I'd
    rather use server side controls because of their other benefits.

    Thanks very much in advance,


    Damien
  • AleXmanFree

    #2
    Re: Disabling image path rebasing

    Could you show an example how it transforms your constant URL ?
    there are several methods like ResloveURL or ResolveClientUr l have u
    tried these kind of methods and see if something cold be helpful?

    Comment

    • AleXmanFree

      #3
      Re: Disabling image path rebasing

      forgot to leave this link, could be helpful: http://www.west-wind.com/weblog/posts/269.aspx

      Comment

      • DamienS

        #4
        Re: Disabling image path rebasing

        Hi,

        Thanks for that.

        The issue was to do with the 'rebasing' of images when using Master
        pages (Lookup "URL Rebasing In Master Pages" in http://www.odetocode.com/Articles/419.aspx).

        Your article helped alot though in that I used it to just create a
        'fully formed' URL. It appears that rebasing only occurs when the URL
        passed to a control is 'relative'.

        If you're interested, the code I ended up with was

        _images.ToList( ).ForEach(x =>
        {
        // Need to pass the fully formed URL to prevent
        rebasing.
        string URL =
        Request.Url.Abs oluteUri.Replac e(Request.FileP ath, "/tempfiles/") +
        x.ThumbanailFil eName(false);
        Image i = new Image() { ImageUrl = URL };
        this.ph1.Contro ls.Add(i);
        });


        Thanks very much for your help.



        Damien

        Comment

        Working...