HttpWebRequest permission fejl
HejEr der nogen der ved hvad jeg kan gøre ved følgende fejl:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
Line 10: Dim Html As String = ""
Line 11:
Line 12: Dim req As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
Line 13: Dim resp As HttpWebResponse = CType(req.GetResponse, HttpWebResponse)
Line 14: Dim sr As StreamReader = New StreamReader(resp.GetResponseStream)
Den kommer når jeg bruger følgende function:
Public Function ExecuteURL(ByVal URL As String) As String
Dim Html As String = ""
Dim req As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
Dim resp As HttpWebResponse = CType(req.GetResponse, HttpWebResponse)
Dim sr As StreamReader = New StreamReader(resp.GetResponseStream)
Html = sr.ReadToEnd
Return Html
End Function
