Skip to main content
Home Forums Silverlight Programming Accessing Web Services with Silverlight Local HTTPHandler
5 replies. Latest Post by Jonathan Shen – MSFT on November 9, 2009.
(0)
ricky_br...
Member
0 points
3 Posts
11-03-2009 6:05 AM |
In the past I have created HTTPHandlers to create images that dynamically changed. What I would like to do is create these images on the client side rather than the server side. The only draw back is that I need to be able to access this local service via a query string as certain properties will need to be passed to this service. I was thinking that I could host the handler in the ClientBin but I'm not sure how easy this will be. Does anyone know of some good resources that show how I can do this?
Sergey.L...
Contributor
7256 points
1,354 Posts
11-03-2009 6:15 AM |
Hi,
You can use handler as is. Use WebClient or WebRequest to make request to handler.
11-03-2009 6:27 AM |
That's close but that requires the web service to be on the server. I want to host the web service locally in the ClientBin. I want all the work that the web service would do to be done on the client side rather than on the server. My reason is that I'm expecting extremely high volume of traffic on the server and expect multiple calls to the web service from each client. If I have the web service on the client side then they only download the xap file when the page loads and all calls are made locally.
A bit more information: I'm using a pre-built control that takes in a query string and already retrieves the image. I'm aware of how to point the url to the client bin but need to figure out how to create the httpHandler in the xap.
11-03-2009 6:38 AM |
You can't include handler in client application. It is a server side feature.
If you want generate images at client side look at Bitmap API, feature of Silverlight 3
11-03-2009 6:50 AM |
After some investigation I think this might suit my needs: http://pagebrooks.com/archive/2009/04/25/a-cool-trick-for-passing-data-to-a-silverlight-application.aspx
Now I just need to figure out what method this will call in my xap.
Jonathan...
All-Star
24982 points
2,435 Posts
11-09-2009 4:59 AM |
Hi Ricky,
Application.Current.Host.Source.OriginalString and Application.Current.Host.InitParams are public static type. We can call it everywhere in your silverlight application. By the way, both HttpHandler and WebService work on sever side. You'd better reference to Bitmap API.
Best regards,
Jonathan