views:

499

answers:

1

I am using Silverlight 3 beta and Visual Studio 2008 SP1 for this.

In the web application (Server side) I have a HTTP handlter ImageFetcher.ashx which expects an ID parameter from the query string and retrieves the data from database and writes it to output stream. This is working fine and I have tested it with a test aspx page adding a image control with src=ImageFetcher.ashx?id=44.

I also have a silverlight client navgatoin application in the same solution. I have the following image tag in my xaml

<Image x:Name="myImage"  Width="400" Height="300" Stretch="Uniform" Source="/ImageFetcher.ashx?id=44"/>

When I run this app, it fails to retrieve the image. When I debugged the handler, I noticied that it is not getting any querystring parameter. if the change the image tag to use absolute URL as below it works fine again

<Image x:Name="myImage"  Width="400" Height="300" Stretch="Uniform" Source="http://localhost:5573/ImageTest/ImageFetcher.ashx?id=44"/&gt;

But I cannot use the absolute URL, what is wrong here? why the relative URL does not carry the querystring correctly to the server side?

Thanks Shreedhar

A: 

I posted on Silverlight forums as well, but I'll copy it here too.

A relative URL is relative to the XAP - which is loaded on the client machine. Once the XAP is downloaded to the client, the loading ashx page will no longer be relative to the XAP and will therefore not be found. Once you make the url absolute, you are telling it to look on your local host [the exact location] for the loading page.

related questions