Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a RIA in silverlight which allows you to upload an image.
MIDL
Uri u = new Uri(PhotoAlbum.App.Current.Host.Source, "/upload.ashx/?filename=" + fileName);
WebClient c = new WebClient();


So the actual uploading goes fine. But I can't figure out a way to retrieve where it has been uploaded. I use a fixed upload path. /x/date/name

Though if the name already exists in the map, I rename it(Random chars based on current names length)

Though if uploading is finished I can't find a way to retrieve the "image link" (Like in a way, I do not know how I can make the upload.ashx return or send something back to the RIA, as it probably is impossible?).

Have been stuck for a few days now... Could really use some help. I need a way of telling my RIA the files, so it can popup a child window with the links to them.

Help is much appreciated..
Posted

Before starting let me say I am not an RIA user.

A web page (which is what an ASHX resolves to from the client point of view) has content. In that content you can put whatever you like, which the client (RIA) needs to parse. Your ASHX code has access to context.Response and in there you can put the actual file name.

RIA seems to deal with WCF web services so I guess you are calling upload.ashx outside the RIA service calls? (Perhaps you could add the code that actually calls the uploader?) So in the response handler on the Silverlight client side for the upload, check the response for the information you put in there from the ASHX.

If you are calling it as a web service you will need to wrap the information up in an XML package.
 
Share this answer
 
Sorry yes, this is indeed the answer... Can't see how i've missed that, by simply making a HttpResponse and writing what u want back I got the needed items!

So if anyone has a similiar question send a response with HttpResponse and read it from the sender!
Thanks for the help!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900