Home > other >  'HttpRequest' does not contain a definition for 'Params' and 'url'
'HttpRequest' does not contain a definition for 'Params' and 'url'

Time:05-27

Im working on my project Employee Site using asp.net.core , Im facing problem in PayPal Gateway integration with Asp.net.core. I have created a controller called PaymentController taking help from https://www.c-sharpcorner.com/article/paypal-payment-gateway-integration-in-asp-net-mvc/ for ActionResult.

'HttpRequest' does not contain a definition for 'Params' and no accessible extension method 'Params' accepting a first argument of type 'HttpRequest' could be found (are you missing a using directive or an assembly reference?

at this line im facing error: string payerId = Request.Params["PayerID"];

at this line too with url: string baseURI = Request.Url.Scheme "://" Request.Url.Authority "/Home/PaymentWithPayPal?";

CodePudding user response:

(in .NET CORE) Use:

var payerID = HttpContext.Request.Query["PayerID"].ToString()

CodePudding user response:

Make sure you are calling the necessary class:

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using WebApplication7.Models;
using PayPal.Api;
using PayPal.Util;
using PayPal.Api.OpenIdConnect;
  • Related