开发者

Access HttpContext of Silverlight page in asmx service

I'm sorry if this has been asked - I can't seem to find it if so.

If I have a silverlight 4 page calling a plain old asmx web service, is there a way to access the http context of the aspx page hosting my silverlight from the asmx WebMethod?

HttpContext.Current seems to relate to the call to the service (the path property is the path to the asmx file) and so HttpContext.Current.Request.QueryString (what I'm开发者_开发知识库 really after) is empty.


You could pass the QueryString object as a parameter to the asmx service.

from silverlight you can get the query string of the host page using the code below.

var queryString = System.Windows.Browser.HtmlPage.Document.QueryString;

var id = System.Windows.Browser.HtmlPage.Document.QueryString["id"]; //if u want a specific item

Hope this helps


No, you can only access the context of the current call. What you need to do is send the information that you are interested in, the query string (or parts of it), to your web service method as a parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜