Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 访问quickpay API不提供任何权限_C#_Vb.net_Payment Gateway_Payment - Fatal编程技术网

C# 访问quickpay API不提供任何权限

C# 访问quickpay API不提供任何权限,c#,vb.net,payment-gateway,payment,C#,Vb.net,Payment Gateway,Payment,不幸的是,我的英语很差,但我尽力让你理解我 这就是为什么我会遇到这样的问题,我无法访问Quickpay的API protected void Page_Load(object sender, EventArgs e) { var datoIdag = DateTime.Today.ToString("dd/MM/yyyy"); var chars = "123456789"; var randomA = new Rand

不幸的是,我的英语很差,但我尽力让你理解我

这就是为什么我会遇到这样的问题,我无法访问Quickpay的API

protected void Page_Load(object sender, EventArgs e)
{

            var datoIdag = DateTime.Today.ToString("dd/MM/yyyy");

            var chars = "123456789";
            var randomA = new Random();
            var result = new string(
            Enumerable.Repeat(chars, 3)
            .Select(s => s[randomA.Next(s.Length)])
            .ToArray());

            var chars2 = "abcdefghijklmno";
            var randomA2 = new Random();
            var result2 = new string(
            Enumerable.Repeat(chars2, 2)
            .Select(s => s[randomA2.Next(s.Length)])
            .ToArray());

            Session["orderId"] = result2 + result + "-" + datoIdag;


            string protocol_value = "1";
            string msgtype_value = "authorize";
            string language_value = "da";
            string autocapture_value = "0";
            string ordernum_value = Session["orderId"].ToString();
            //generate an arbitrary ordernumber
            string merchant_value = "89898978";
            string amount_value = readerPriser["priser"].ToString();
            string qp_currency_value = "DKK";
            //[check available parameters on quickpay.net]
            string okpage_value = "~/PayContinue";
            string errorPage_value = "~/PayCallback";
            string resultpage_value = "~/PayError";
            string md5secret_value = "29p61DveBZ79c3144LW61lVz1qrwk2gfAFCxPyi5sn49m3Y3IRK5M6SN5d8a68u7";
            string md5check_value = GenerateHash(string.Concat(protocol_value.ToString(), msgtype_value, merchant_value, language_value, ordernum_value, amount_value.ToString(), qp_currency_value, okpage_value, errorPage_value, resultpage_value,
            autocapture_value.ToString(), md5secret_value));

            protocol.Value = protocol_value;
            msgtype.Value = msgtype_value;
            language.Value = language_value;
            autocapture.Value = autocapture_value;
            ordernumber.Value = ordernum_value;
            merchant.Value = merchant_value;
            amount.Value = amount_value;
            currency.Value = qp_currency_value;
            continueurl.Value = okpage_value;
            cancelurl.Value = errorPage_value;
            callbackurl.Value = resultpage_value;
            md5check.Value = md5check_value;


    }
}

private string GenerateHash(string Input)
{
    System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
    byte[] bs = System.Text.Encoding.UTF8.GetBytes(Input);
    bs = x.ComputeHash(bs);
    System.Text.StringBuilder s = new System.Text.StringBuilder();
    foreach (byte b in bs) {
        s.Append(b.ToString("x2").ToLower());
    }
    dynamic outstr = s.ToString();
    return outstr;
}
public _Default()
{
    Load += Page_Load;
}
每当我试着调试代码,看看哪里是我的错,它就会回来告诉我这一点。

如果我编写www.blabla.com/PayContinue,那么它将不会显示为继续使用quickpay api

如果我写了正确的地址so handelsbetingelserContinue.aspx,那么它会这样做,并显示为Null。但事实并非如此

Quickpay只进入了vb.net,您可以在这里看到与我从vb.net转换到c完全相同的文件#


奇怪的是,这段代码应该在第二个ExecuteReader失败。在使用不同的命令重复使用同一命令之前,不清除参数集合。在图像中发布错误是不正确的。只有在没有其他方法证明问题时,才应使用图像。移动用户很难看到它们,它们经常被公司代理服务器阻止(这意味着它们不适用于那些读者),而且对于那些仍然为数据/带宽付费的用户来说,它们的成本是不必要的。请回答您的问题,并将图像替换为您收到的文本错误。在编辑过程中,删除所有与问题无关的代码(例如所有与UI和DB相关的代码)。@KenWhite现在好了吗?很好,您删除了许多不必要的代码,但是错误消息的图像链接仍然存在,错误消息没有。您需要在此处包含错误消息的文本。(没有图片,而是文字。)
    Imports System.Security.Cryptography

Partial Class _Default
    Inherits System.Web.UI.Page

    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        Dim protocol_value As Integer = 7
        Dim msgtype_value As String = "authorize"
        Dim language_value As String = "da"
        Dim autocapture_value As Integer = 0
        Dim ordernum_value As String = Now.Ticks 'generate an arbitrary ordernumber
        Dim merchant_value As Integer = 89898978
        Dim amount_value As Integer = 100
        Dim qp_currency_value As String = "DKK" '[check available parameters on quickpay.net]
        Dim okpage_value As String = "http://xprospects.local/continue.aspx"
        Dim errorPage_value As String = "http://xprospects.local/cancel.aspx"
        Dim resultpage_value As String = "http://xprospects.local/callback.aspx"
        Dim md5secret_value As String = "29p61DveBZ79c3144LW61lVz1qrwk2gfAFCxPyi5sn49m3Y3IRK5M6SN5d8a68u7"
        Dim md5check_value As String = GenerateHash(String.Concat(protocol_value.ToString, msgtype_value, merchant_value, language_value, ordernum_value, amount_value.ToString, qp_currency_value, okpage_value, errorPage_value, resultpage_value, autocapture_value.ToString, md5secret_value))

        protocol.Value = protocol_value
        msgtype.Value = msgtype_value
        language.Value = language_value
        autocapture.Value = autocapture_value
        ordernumber.Value = ordernum_value
        merchant.Value = merchant_value
        amount.Value = amount_value
        currency.Value = qp_currency_value
        continueurl.Value = okpage_value
        cancelurl.Value = errorPage_value
        callbackurl.Value = resultpage_value
        md5check.Value = md5check_value

    End Sub

    Private Function GenerateHash(ByVal Input As String) As String
        Dim x As System.Security.Cryptography.MD5CryptoServiceProvider = New System.Security.Cryptography.MD5CryptoServiceProvider()
        Dim bs As Byte() = System.Text.Encoding.UTF8.GetBytes(Input)
        bs = x.ComputeHash(bs)
        Dim s As System.Text.StringBuilder = New System.Text.StringBuilder()
        For Each b As Byte In bs
            s.Append(b.ToString("x2").ToLower())
        Next
        Dim outstr = s.ToString()
        Return outstr
    End Function



End Class