Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   System.Security.SecurityException: Error de solicitud de permiso de tipo System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. (http://www.velocityreviews.com/forums/t106329-system-security-securityexception-error-de-solicitud-de-permiso-de-tipo-system-net-webpermission-system-version-1-0-5000-0-culture-neutral-publickeytoken-b77a5c561934e089.html)

Luis Esteban Valencia 07-14-2005 01:43 PM

System.Security.SecurityException: Error de solicitud de permiso de tipo System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
 
Hello I have this error when I submit the page with the following code. I
had never see this kind of errors.

Thanks

private void btnsubmit_Click(object sender, System.EventArgs e)

{

string requestLocation = "http://estacion15/HTTPSender/BTSHTTPReceive.dll";

Status.Text = "";

XmlDocument xmlDocument = new XmlDocument();

xmlDocument.PreserveWhitespace = true;

XmlNode tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element,
"Activity", "http://que.activity");

xmlDocument.AppendChild(tempXmlNode);

tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Attribute, "type", "");

tempXmlNode.Value = type.SelectedItem.Text;

xmlDocument.DocumentElement.Attributes.Append( (XmlAttribute)tempXmlNode);

tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element, "Location", "");

tempXmlNode.InnerText = location.Text;

xmlDocument.DocumentElement.AppendChild(tempXmlNod e);

tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element, "Timestamp", "");

DateTime now = DateTime.Now;

tempXmlNode.InnerText = now.ToString("s");

xmlDocument.DocumentElement.AppendChild(tempXmlNod e);

tempXmlNode = xmlDocument.CreateNode(XmlNodeType.Element, "Notes", "");

tempXmlNode.InnerText = notes.Text;

xmlDocument.DocumentElement.AppendChild(tempXmlNod e);

try

{

HttpWebRequest request = (HttpWebRequest)
HttpWebRequest.Create(requestLocation);

request.Method = "POST";

ASCIIEncoding encoding = new ASCIIEncoding();

byte[] requestData = encoding.GetBytes(xmlDocument.OuterXml);

request.ContentType="application/x-www-form-urlencoded";

request.ContentLength = xmlDocument.OuterXml.Length;

Status.Text += "Submitting activity message";

Stream requestStream = request.GetRequestStream();

requestStream.Write(requestData,0,requestData.Leng th);

requestStream.Flush();

requestStream.Close();

HttpWebResponse response = (HttpWebResponse) request.GetResponse();

StreamReader responseData = new StreamReader( response.GetResponseStream());

Status.Text = System.Web.HttpUtility.HtmlEncode( responseData.ReadToEnd()) +
"<br>";

}

catch (WebException wex)

{

Status.Text = "Unable to complete web request. Web Exception error: " +
wex.Message;

}

}



}



Error de servidor en la aplicación '/HTTPSender'.
----------------------------------------------------------------------------
----

Excepción de seguridad
Descripción: La aplicación intentó realizar una operación no permitida por
la directiva de seguridad. Para otorgar a esta aplicación los permisos
necesarios, póngase en contacto con el administrador del sistema o cambie el
nivel de confianza de la aplicación en el archivo de configuración.

Detalles de la excepción: System.Security.SecurityException: Error de
solicitud de permiso de tipo System.Net.WebPermission, System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.

Error de código fuente:

[Líneas de código fuente no relevantes]

Archivo de origen: webform1.aspx.cs Línea: 84

Seguimiento de la pila:

[SecurityException: Error de solicitud de permiso de tipo
System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089.]
System.Security.CodeAccessSecurityEngine.CheckHelp er(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken) +666
System.Security.CodeAccessSecurityEngine.Check(Per missionToken permToken,
CodeAccessPermission demand, StackCrawlMark& stackMark, Int32 checkFrames,
Int32 unrestrictedOverride) +0
System.Security.CodeAccessSecurityEngine.Check(Cod eAccessPermission cap,
StackCrawlMark& stackMark) +88
System.Security.CodeAccessPermission.Demand() +62
System.Net.HttpRequestCreator.Create(Uri Uri)
System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
System.Net.WebRequest.Create(String requestUriString)
HTTPSender.WebForm1.btnsubmit_Click(Object sender, EventArgs e) in
webform1.aspx.cs:84
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
stBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)

System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87



----------------------------------------------------------------------------
----
Información de versión: Versión de Microsoft .NET Framework:1.1.4322.985;
Versión de ASP.NET:1.1.4322.968




All times are GMT. The time now is 08:09 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.