大佬教程收集整理的这篇文章主要介绍了Silverlight使用HttpWebRequest和HttpWebResponse时发生System.Security.SecurityException: 安全性错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
异常代码发生在第二句
httpWebrequest request = result.AsyncState as httpWebrequest;
WebResponse response = request.EndGetResponse(result);
提示信息:
System.Security.SecurityException ---> System.Security.SecurityException: 安全性错误。
位于 System.Net.browser.browserhttpWebrequest.InternalEndGetResponse(IAsyncResult asyncResult)位于 SilverlightApplication2.MainPage.ResponseCallBACk(IAsyncResult result)
解决:
crossdomain.xml和clientaccesspolicy.xml
------------------------------------------------------------------------
--crossdomain.xml--
------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYstem " http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>
------------------------------------------------------------------------
--clientaccesspolicy.xml--
------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <access-policy> @R_262_1748@ <cross-domain-access> @R_262_1748@ <policy> @R_262_1748@ <allow-from http-request-headers="*"> @R_262_1748@ <domain uri="*"/> @R_262_1748@ </allow-from> @R_262_1748@ <grant-to> @R_262_1748@ <resource path="/" include-subpaths="true"/> @R_262_1748@ </grant-to> @R_262_1748@ </policy> @R_262_1748@ </cross-domain-access> </access-policy>以上是大佬教程为你收集整理的Silverlight使用HttpWebRequest和HttpWebResponse时发生System.Security.SecurityException: 安全性错误全部内容,希望文章能够帮你解决Silverlight使用HttpWebRequest和HttpWebResponse时发生System.Security.SecurityException: 安全性错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。