473,378 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

MSXML.ServerXMLHTTP.3.0. returns error

Hello I am trying to set up a postback page for paypal. I got the code from paypal but it keeps returning the following error:

Server Error in '/' Application.

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.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:


Line 25:
Line 26: 'objHttp = Server.CreateObject("Microsoft.XMLHTTP")
Line 27: objHttp = Server.CreateObject("MSXML.ServerXMLHTTP.3.0.")
Line 28: objHttp.open("POST", "https://www.sandbox.paypal.com/cgi-bin/webscr", False)
Line 29: objHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")

this is the code I am trying to run from paypal.

(sorry the code is so long I wanted to make sure you could see everything)
Expand|Select|Wrap|Line Numbers
  1.  
  2.            Try
  3.             Dim authToken, txToken As String
  4.             Dim query As String
  5.             Dim objHttp As Object
  6.             Dim sQuerystring As String
  7.             Dim sParts() As String
  8.             Dim iParts As Integer
  9.             Dim aParts() As String
  10.             Dim sResults(0, 0), sKey, sValue As String
  11.             Dim i As Integer
  12.             Dim txstatus, firstName, lastName, businessname, email, itemnumber, itemName, mcGross, mcCurrency, custom, test_pdt As String
  13.  
  14.             authToken = "myPayPalToken"
  15.  
  16.             txToken = Request.QueryString("tx").ToString()
  17.  
  18.             query = "cmd=_notify-synch&tx=" & txToken & "&at=" & authToken & "&test_pdt=" & test_pdt
  19.  
  20.             'objHttp = Server.CreateObject("Microsoft.XMLHTTP")
  21.             objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
  22.             tbNotes.Text = "server.createObject completed"
  23.             objHttp.open("POST", "https://www.paypal.com/cgi-bin/webscr", False)
  24.             objHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
  25.             objHttp.Send(query)
  26.  
  27.             sQuerystring = objHttp.responseText
  28.  
  29.  
  30.             If Mid(sQuerystring, 1, 7) = "SUCCESS" Then
  31.                 txstatus = "SUCCESS"
  32.  
  33.                 sQuerystring = Mid(sQuerystring, 9)
  34.                 sParts = Split(sQuerystring, vbLf)
  35.                 iParts = UBound(sParts) - 1
  36.                 ReDim sResults(iParts, 1)
  37.                 For i = 0 To iParts
  38.                     aParts = Split(sParts(i), "=")
  39.                     sKey = aParts(0)
  40.                     sValue = aParts(1)
  41.                     sResults(i, 0) = sKey
  42.                     sResults(i, 1) = sValue
  43.  
  44.                     Select Case sKey
  45.                         Case "first_name"
  46.                             firstName = sValue
  47.                         Case "last_name"
  48.                             lastName = sValue
  49.                         Case "payer_business_name"
  50.                             businessname = sValue
  51.                         Case "payer_email"
  52.                             email = sValue.Replace("%40", "@")
  53.                         Case "item_number"
  54.                             itemnumber = sValue
  55.                         Case "item_name"
  56.                             itemName = sValue
  57.                         Case "mc_gross"
  58.                             mcGross = sValue
  59.                         Case "mc_currency"
  60.                             mcCurrency = sValue
  61.                         Case "custom"
  62.                             custom = sValue
  63.                     End Select
  64.                 Next
  65.                 tbEmail.Text = email
  66.  
  67.                 ' Response.Write("<p><h3>Your order has been received.</h3></p>")
  68.                 ' Response.Write("<b>Details</b><br>")
  69.                 ' Response.Write("<li>Name: " & firstName & " " & lastName & "</li>")
  70.                 ' Response.Write("<li>Business: " & businessname & "</li>")
  71.                 ' Response.Write("<li>Email: " & email & "</li>")
  72.                 ' Response.Write("<li>Item: " & itemnumber & "</li>")
  73.                 ' Response.Write("<li>Description: " & itemName & "</li>")
  74.                 ' Response.Write("<li>Amount: " & mcCurrency & " " & mcGross & "</li>")
  75.                 ' Response.Write("<li>Custom: " & custom & "</li>")
  76.                 ' Response.Write("<hr>")
  77.  
  78.             Else
  79.                 'if payment failed redirect to home page  
  80.                 Response.Redirect("~/default.aspx")
  81.             End If
  82.  
  83.         Catch ex As Exception
  84.  
  85.             'Response.Write(ex.Message)
  86.         End Try
  87.  
  88.  
Thanks Gary
Aug 7 '10 #1
0 1356

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Owen | last post by:
Hi, can somebody help me please... I'm trying to set up a very simple asp page that sends me an email when it runs. This is just to try and get CDOSYS working so I can send out emails from my...
1
by: mohn3310 | last post by:
We're having some problems with foreign characters using ServerXMLHTTP. We have an asp page that calls a function in COM through ServerXMLHTTP. The COM component returns xml data. If that data...
1
by: Rodrigo-Dublin | last post by:
Hello there I wrote a web site in c# and I'm using forms authentication for some of the pages in the root folder. The site is fully accessible from the web no problem, but when I request crawler...
3
by: RodrigoIreland | last post by:
Hello there I wrote a web site in csharp and I'm using forms authentication for some of the pages in the root folder. The site is fully accessible from the web no problem, but when I request...
6
by: Frankie Montenegro | last post by:
Hi everyone, I need some help with the following C++ code. It is supposed to read input line by line, each line as one string; then split each string into its component words and store these...
4
by: Afterburn | last post by:
Hi, Has anyone ever experienced this error occuring when trying to call AddPrinterConnection() from VC6. This is a microsoft defined method call. I have been able to reproduce it on a windows200...
2
by: Shimon Sim | last post by:
I tried to use Precompile.axd to compile my site but got HTTP404 (The resource cannot be found) instead. I am running ASP.NET Version:2.0.50727.42 .. Any suggestions? Thank you, Shimon.
0
by: jacksonmacd | last post by:
Trying to send email from Access 97. It used to work properly on this computer, but something has changed and it now returns Error 2287 from this code snippet: Sub test() DoCmd.SendObject...
12
by: haridharmajan | last post by:
In my form i have two fields say fld1 and fld2. fld1 have data like 1,2,3,8,20. now I need to calculate the length of fld1 and assign it to fld2 he in this example fld2 must have 5. I used ...
3
by: Ananthu | last post by:
Hi, I use BulkSMSGateway - ATSMS.dll for sending SMS from ASP.NET. When I click Connect button, I am able to connect to the mobile using bluetooth successfully from my WebPage. But when i...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.