Disabling image path rebasing

D

DamienS

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
 
A

AleXmanFree

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

DamienS

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.AbsoluteUri.Replace(Request.FilePath, "/tempfiles/") +
x.ThumbanailFileName(false);
Image i = new Image() { ImageUrl = URL };
this.ph1.Controls.Add(i);
});


Thanks very much for your help.



Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top