نمایش نتایج 1 تا 2 از 2

نام تاپیک: خطا - Value cannot be null. Parameter name: String

  1. #1
    کاربر دائمی آواتار razeghaik1
    تاریخ عضویت
    آبان 1389
    محل زندگی
    عسلویه
    پست
    258

    خطا - Value cannot be null. Parameter name: String

    ا سلام و احترام
    دوستان من با استفاده از یک سمپل توی اینترنت اتصال درگاه بانک ملت رو توی سایتم استفاده کردم.همه چی خوب کار می کنه و پول از حساب کسر می شه و زمانی که ریدایرکت می شه به صفحه ای که باید بگه همه چیز صحیح انجام شده با خطای زیر مواجه می شم و بعد از چند ثانیه مجدد پول کسر شده از حساب مشتری به علت عدم تراکنش صحیح به حساب مشتری واریز می شه.
    از دوستان کسی می تونه کمکم کنه؟ ممنون
    Server Error in '/' Application.

    Value cannot be null.
    Parameter name: String
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.ArgumentNullException: Value cannot be null.
    Parameter name: String

    اگر اطلاعات خاصی هم میتونه به حل مساله کمک کنه تا ارسال کنم.ممنون

    اینم کدهای صفحه صلی

    اینم کدهای صفحه صلی
    namespace BankMellat_WebForms
    {
    public partial class _default : System.Web.UI.Page
    {
    public static readonly string PgwSite = ConfigurationManager.AppSettings["PgwSite"];
    public static readonly string CallBackUrl = ConfigurationManager.AppSettings["CallBackUrl"];
    public static readonly string TerminalId = ConfigurationManager.AppSettings["TerminalId"];
    public static readonly string UserName = ConfigurationManager.AppSettings["UserName"];
    public static readonly string UserPassword = ConfigurationManager.AppSettings["UserPassword"];
    void BypassCertificateError()
    {
    ServicePointManager.ServerCertificateValidationCal lback +=
    delegate(
    Object sender1,
    X509Certificate certificate,
    X509Chain chain,
    SslPolicyErrors sslPolicyErrors)
    {
    return true;
    };
    }
    public static string RefId = "";
    public string SetDefaultDate()
    {
    return DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0');

    }
    public string SetDefaultTime()
    {
    return DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + DateTime.Now.Second.ToString().PadLeft(2, '0');
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnpayment_Click(object sender, EventArgs e)
    {
    //get values from form
    string _name = txtname.Text;
    string _email = txtemail.Text;
    string __amount = txtamount.Text;
    int _amount = int.Parse(__amount);
    //save record to database
    int? record_id = 0;
    var db = new dbDataContext();
    db.InsertPayment(_name, _email, _amount, "پرداخت نشده", ref record_id);
    //================================================== ========================
    try
    {
    string result = "";
    BypassCertificateError();
    BankMellat.PaymentGatewayClient bp = new BankMellat.PaymentGatewayClient();
    result = bp.bpPayRequest(Int64.Parse(TerminalId), UserName, UserPassword, long.Parse(record_id.Value.ToString()), _amount, SetDefaultDate(), SetDefaultTime(), "irarzan.ir", CallBackUrl, 0);
    string[] res = result.Split(',');
    if (res[0] == "0")
    {
    db.UpdatePayment("پرداخت نشده", res[1], "", record_id);
    ClientScript.RegisterStartupScript(typeof(Page), "clientscript", "<script>postRefId('" + res[1] + "')</script>");
    }
    else
    {
    msglabel.Text = "خطای " + res[0] + " در ارتباط با بانک";
    }
    }
    catch
    {
    msglabel.Text = "خطا در ارتباط با بانک";
    }
    //================================================== ========================

    }
    }
    }



    namespace BankMellat_WebForms
    {
    public partial class payment : System.Web.UI.Page
    {
    public static readonly string PgwSite = ConfigurationManager.AppSettings["PgwSite"];
    public static readonly string CallBackUrl = ConfigurationManager.AppSettings["CallBackUrl"];
    public static readonly string TerminalId = ConfigurationManager.AppSettings["TerminalId"];
    public static readonly string UserName = ConfigurationManager.AppSettings["UserName"];
    public static readonly string UserPassword = ConfigurationManager.AppSettings["UserPassword"];
    void BypassCertificateError()
    {
    ServicePointManager.ServerCertificateValidationCal lback +=
    delegate(
    Object sender1,
    X509Certificate certificate,
    X509Chain chain,
    SslPolicyErrors sslPolicyErrors)
    {
    return true;
    };
    }
    public static string RefId = "";
    public string SetDefaultDate()
    {
    return DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0');

    }
    public string SetDefaultTime()
    {
    return DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + DateTime.Now.Second.ToString().PadLeft(2, '0');
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    if (Request.Params["ResCode"] != null)
    {
    string _rescode = Request.Params["ResCode"];
    string _refid = Request.Params["RefId"];
    string _saleorderid = Request.Params["SaleOrderId"];
    string _salerefrenceid = Request.Params["SaleRefrenceId"];
    if (_rescode == "0")
    {
    string result = "";
    BypassCertificateError();
    BankMellat.PaymentGatewayClient bp = new BankMellat.PaymentGatewayClient();
    result = bp.bpVerifyRequest(Int64.Parse(TerminalId), UserName, UserPassword, long.Parse(_saleorderid), long.Parse(_saleorderid), long.Parse(_salerefrenceid));
    if (result == "0")
    {
    var db = new dbDataContext();
    var payment_id = db.tblPayments.Where(c => c.RefID == _refid).Single();
    db.UpdatePayment("پرداخت شده", _refid, _salerefrenceid, payment_id.id);
    msglabel.Text = "پرداخت شما با موفقیت انجام شد" + "<br />" + "شماره پیگیری تراکنش: " + _salerefrenceid;
    }
    else
    {
    msglabel.Text = "پرداخت آنلاین با خطا مواجه شده است.";
    }
    }
    else
    {
    msglabel.Text = "پرداخت آنلاین با خطا مواجه شده است.";
    }
    }
    }
    }
    }

    ----------------------------------------------------------------
    این هم Stack Trace خطا
    Stack Trace:
    [ArgumentNullException: Value cannot be null.
    Parameter name: String]
    System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +12727501
    System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt) +133
    System.Int64.Parse(String s) +24
    System.Web.UI.Control.OnLoad(EventArgs e) +95
    BankMellat_WebForms.payment.Page_Load(Object sender, EventArgs e) +698
    System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +51
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
    System.Web.UI.Control.LoadRecursive() +59

  2. #2
    کاربر دائمی آواتار razeghaik1
    تاریخ عضویت
    آبان 1389
    محل زندگی
    عسلویه
    پست
    258

    نقل قول: خطا - Value cannot be null. Parameter name: String

    نقل قول نوشته شده توسط razeghaik1 مشاهده تاپیک
    ا سلام و احترام
    دوستان من با استفاده از یک سمپل توی اینترنت اتصال درگاه بانک ملت رو توی سایتم استفاده کردم.همه چی خوب کار می کنه و پول از حساب کسر می شه و زمانی که ریدایرکت می شه به صفحه ای که باید بگه همه چیز صحیح انجام شده با خطای زیر مواجه می شم و بعد از چند ثانیه مجدد پول کسر شده از حساب مشتری به علت عدم تراکنش صحیح به حساب مشتری واریز می شه.
    از دوستان کسی می تونه کمکم کنه؟ ممنون
    Server Error in '/' Application.

    Value cannot be null.
    Parameter name: String
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.ArgumentNullException: Value cannot be null.
    Parameter name: String

    اگر اطلاعات خاصی هم میتونه به حل مساله کمک کنه تا ارسال کنم.ممنون

    اینم کدهای صفحه صلی

    اینم کدهای صفحه صلی
    namespace BankMellat_WebForms
    {
    public partial class _default : System.Web.UI.Page
    {
    public static readonly string PgwSite = ConfigurationManager.AppSettings["PgwSite"];
    public static readonly string CallBackUrl = ConfigurationManager.AppSettings["CallBackUrl"];
    public static readonly string TerminalId = ConfigurationManager.AppSettings["TerminalId"];
    public static readonly string UserName = ConfigurationManager.AppSettings["UserName"];
    public static readonly string UserPassword = ConfigurationManager.AppSettings["UserPassword"];
    void BypassCertificateError()
    {
    ServicePointManager.ServerCertificateValidationCal lback +=
    delegate(
    Object sender1,
    X509Certificate certificate,
    X509Chain chain,
    SslPolicyErrors sslPolicyErrors)
    {
    return true;
    };
    }
    public static string RefId = "";
    public string SetDefaultDate()
    {
    return DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0');

    }
    public string SetDefaultTime()
    {
    return DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + DateTime.Now.Second.ToString().PadLeft(2, '0');
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnpayment_Click(object sender, EventArgs e)
    {
    //get values from form
    string _name = txtname.Text;
    string _email = txtemail.Text;
    string __amount = txtamount.Text;
    int _amount = int.Parse(__amount);
    //save record to database
    int? record_id = 0;
    var db = new dbDataContext();
    db.InsertPayment(_name, _email, _amount, "پرداخت نشده", ref record_id);
    //================================================== ========================
    try
    {
    string result = "";
    BypassCertificateError();
    BankMellat.PaymentGatewayClient bp = new BankMellat.PaymentGatewayClient();
    result = bp.bpPayRequest(Int64.Parse(TerminalId), UserName, UserPassword, long.Parse(record_id.Value.ToString()), _amount, SetDefaultDate(), SetDefaultTime(), "irarzan.ir", CallBackUrl, 0);
    string[] res = result.Split(',');
    if (res[0] == "0")
    {
    db.UpdatePayment("پرداخت نشده", res[1], "", record_id);
    ClientScript.RegisterStartupScript(typeof(Page), "clientscript", "<script>postRefId('" + res[1] + "')</script>");
    }
    else
    {
    msglabel.Text = "خطای " + res[0] + " در ارتباط با بانک";
    }
    }
    catch
    {
    msglabel.Text = "خطا در ارتباط با بانک";
    }
    //================================================== ========================

    }
    }
    }



    namespace BankMellat_WebForms
    {
    public partial class payment : System.Web.UI.Page
    {
    public static readonly string PgwSite = ConfigurationManager.AppSettings["PgwSite"];
    public static readonly string CallBackUrl = ConfigurationManager.AppSettings["CallBackUrl"];
    public static readonly string TerminalId = ConfigurationManager.AppSettings["TerminalId"];
    public static readonly string UserName = ConfigurationManager.AppSettings["UserName"];
    public static readonly string UserPassword = ConfigurationManager.AppSettings["UserPassword"];
    void BypassCertificateError()
    {
    ServicePointManager.ServerCertificateValidationCal lback +=
    delegate(
    Object sender1,
    X509Certificate certificate,
    X509Chain chain,
    SslPolicyErrors sslPolicyErrors)
    {
    return true;
    };
    }
    public static string RefId = "";
    public string SetDefaultDate()
    {
    return DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0');

    }
    public string SetDefaultTime()
    {
    return DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + DateTime.Now.Second.ToString().PadLeft(2, '0');
    }
    protected void Page_Load(object sender, EventArgs e)
    {
    if (Request.Params["ResCode"] != null)
    {
    string _rescode = Request.Params["ResCode"];
    string _refid = Request.Params["RefId"];
    string _saleorderid = Request.Params["SaleOrderId"];
    string _salerefrenceid = Request.Params["SaleRefrenceId"];
    if (_rescode == "0")
    {
    string result = "";
    BypassCertificateError();
    BankMellat.PaymentGatewayClient bp = new BankMellat.PaymentGatewayClient();
    result = bp.bpVerifyRequest(Int64.Parse(TerminalId), UserName, UserPassword, long.Parse(_saleorderid), long.Parse(_saleorderid), long.Parse(_salerefrenceid));
    if (result == "0")
    {
    var db = new dbDataContext();
    var payment_id = db.tblPayments.Where(c => c.RefID == _refid).Single();
    db.UpdatePayment("پرداخت شده", _refid, _salerefrenceid, payment_id.id);
    msglabel.Text = "پرداخت شما با موفقیت انجام شد" + "<br />" + "شماره پیگیری تراکنش: " + _salerefrenceid;
    }
    else
    {
    msglabel.Text = "پرداخت آنلاین با خطا مواجه شده است.";
    }
    }
    else
    {
    msglabel.Text = "پرداخت آنلاین با خطا مواجه شده است.";
    }
    }
    }
    }
    }

    ----------------------------------------------------------------
    این هم Stack Trace خطا
    Stack Trace:
    [ArgumentNullException: Value cannot be null.
    Parameter name: String]
    System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +12727501
    System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt) +133
    System.Int64.Parse(String s) +24
    System.Web.UI.Control.OnLoad(EventArgs e) +95
    BankMellat_WebForms.payment.Page_Load(Object sender, EventArgs e) +698
    System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender, EventArgs e) +51
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
    System.Web.UI.Control.LoadRecursive() +59
    دوستان کسی نظری یا کمکی نداره؟

تاپیک های مشابه

  1. سوال: نحوه حل خطای Value cannot be null. Parameter name: entitySet
    نوشته شده توسط jaykob در بخش ASP.NET MVC
    پاسخ: 4
    آخرین پست: جمعه 11 تیر 1395, 07:34 صبح
  2. Failed to convert parameter value from string to decimal
    نوشته شده توسط dare_khamosh در بخش C#‎‎
    پاسخ: 1
    آخرین پست: پنج شنبه 08 اسفند 1387, 06:05 صبح
  3. Value cannot be null. Parameter name: dataSource
    نوشته شده توسط mth_sh89 در بخش دسترسی به داده ها (ADO.Net و LINQ و ...)
    پاسخ: 15
    آخرین پست: یک شنبه 27 مرداد 1387, 02:25 صبح
  4. ارسال null parameter به detailsview
    نوشته شده توسط maryam_80 در بخش ASP.NET Web Forms
    پاسخ: 2
    آخرین پست: شنبه 20 بهمن 1386, 17:24 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •