Hi All,

I am having problem in developing a .NET user control to be used on a web page. This .NET control will internally call a web service.
The strange thing is when I test my .NET control using a test windows application/form, everything works fine. But if I embed this .NET control on a web page as follows:

<html>
<OBJECT id="123" height=500 width=800 classid="http:netcontrol.dll#netcontrol.myusercont rol"> </OBJECT>
</html>

I get the following error which I display using a MessageBox (coz i couldnt find a better way to debug *-*)

System.Security.SecurityException: Request for the permission of type
System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelp er(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(Per missionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(Cod eAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Web.Services.Protocols.WebClientProtocol.Ge tWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtoco l.GetWebRequest(Uri
uri)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.GetWebRequest(Uri
uri)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)

Has anyone encountered this problem before? If yes, how to solve/work around it.

Thank you very much in advance for any help

--------------------------------
From: Anton Ng

-----------------------
Posted by a user from .NET 247 ([url]http://www.dotnet247.com/[/url])

<Id>L5ZJ9oL1UE6k7KbcQi4f7Q==</Id>