WinHttp.WinHttprequest.5.1 ASP.Net 3.5

Discussion in 'Microsoft Development' started by tomfloate, May 28, 2009.

  1. tomfloate

    tomfloate Perch

    Hi,

    I am trying to connect to a credit card processing company using

    WinHttp.WinHttprequest.5.1

    However this is giving me the following error:

    Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Is this due to medium trust? Is there anyway to get around this?
  2. Stephen

    Stephen US Operations Staff Member

    that would be medium trust, I will be able to check this and the efflare issue in several more hours.

    I am not at a point I can login and check these items now. (I am on public wifi with some port blocking, and for security I'd prefer not to try to get around it)
  3. tomfloate

    tomfloate Perch

    cheers Stephen,

    Look forward to the response.
  4. SubSpace

    SubSpace Bass

    Can I ask why you're using this component rather than the default .NET System.Net.HttpWebRequest functionality? I don't see any obvious advantages.
  5. tomfloate

    tomfloate Perch

    SubSpace ... no reason other than that was in their integration code ... so we used it
  6. SubSpace

    SubSpace Bass

    How silly of them :D
  7. tomfloate

    tomfloate Perch

    Subspace so will HttpWebRequest do the same job?
  8. SubSpace

    SubSpace Bass

    It doesn't use COM to do it's job, and it's more tailored to the .NET way of doing things, but I'm pretty sure it would get the job done.
    That being said, I think some other thread said something about not allowing outgoing socket connections in .NET at all..
    ..okay, I tested it, and it works fine on win24 at least: http://www.subbot.net/misc/Test.aspx

    The page fetches www.google.com and outputs the result. Images and postbacks won't work of course. Can't expect too much from 6 lines of code :)

    Anyway, I've done successful payment gateway integration with HttpWebRequest without too much trouble. Doubt this one would be very different.

    Code:
    using System;
    using System.IO;
    using System.Net;
    
    public partial class misc_Test : System.Web.UI.Page
    {
    	protected void Page_Load(object sender, EventArgs e)
    	{
    		HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com/");
    		HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
    		StreamReader sr = new StreamReader(webResponse.GetResponseStream());
    		Response.Write(sr.ReadToEnd());
    		webResponse.Close();
    		Response.End();
    	}
    }
    

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services