Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7547013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:20:45+00:00 2026-05-30T09:20:45+00:00

I have almost completed a translation from C# to VB.NET, however, I run into

  • 0

I have almost completed a translation from C# to VB.NET, however, I run into some small errors:


  • ‘issuerId’ is already declared as ‘Private Shared issuerid() As String’ in this class. line 17
  • Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.
    line 215
  • Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.
    line 223

ORIGINAL CODE

using System;

namespace sisow
{
public class Sisow
{
    private static string[] issuerid;
    private static string[] issuername;
    private static DateTime lastcheck;

    private string response;

    // Merchant data
    public string merchantId;
    public string merchantKey;
    public string shopId;           // voor toekomstige doeleinden

    // Transaction data
    public string payment;          // empty=iDEAL; ideal=iDEAL; sofort=DIRECTebanking; mistercash=MisterCash
    public string issuerId;         // mandatory; sisow bank code
    public string purchaseId;       // mandatory; max 16 alphanumeric
    public string entranceCode;     // max 40 strict alphanumeric (letters and numbers only)
    public string description;      // mandatory; max 32 alphanumeric
    public double amount;           // mandatory; min 0.45
    public string notifyUrl;
    public string returnUrl;        // mandatory
    public string cancelUrl;
    public string callbackUrl;

    // Status data
    public string status;
    public DateTime timeStamp;
    public string consumerAccount;
    public string consumerName;
    public string consumerCity;

    // Result/check data
    public string trxId;
    public string issuerUrl;

    // Error data
    public string errorCode;
    public string errorMessage;

    // Status
    public const string statusSuccess = "Success";
    public const string statusCancelled = "Cancelled";
    public const string statusExpired = "Expired";
    public const string statusFailure = "Failure";
    public const string statusOpen = "Open";

    public Sisow(string merchantid, string merchantkey)
    {
        this.merchantId = merchantid;
        this.merchantKey = merchantkey;
        shopId = "";
    }

    // voor toekomstige doeleinden
    public Sisow(string merchantid, string merchantkey, string shopid)
    {
        this.merchantId = merchantid;
        this.merchantKey = merchantkey;
        this.shopId = shopid;
    }

    private void error()
    {
        errorCode = parse("errorcode");
        errorMessage = System.Web.HttpUtility.UrlDecode(parse("errormessage"));
    }

    private string parse(string search)
    {
        return parse(response, search);
    }

    private string parse(string xml, string search)
    {
        int start, end;

        if ((start = xml.IndexOf("<" + search + ">")) < 0)
            return null;
        start += search.Length + 2;
        if ((end = xml.IndexOf("</" + search + ">", start)) < 0)
            return null;
        return xml.Substring(start, end - start);
    }

    private bool send(string method, params string[] keyvalue)
    {
        string parms = "";
        string url = "https://www.sisow.nl/Sisow/iDeal/RestHandler.ashx/" + method;
        try
        {
            for (int i = 0; i + 1 < keyvalue.Length; i += 2)
            {
                if (string.IsNullOrEmpty(keyvalue[i + 1]))
                    continue;
                if (!string.IsNullOrEmpty(parms))
                    parms += "&";
                parms += keyvalue[i] + "=" + System.Web.HttpUtility.UrlEncode(keyvalue[i + 1]);
            }
            System.Net.HttpWebRequest hwr = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
            hwr.ContentType = "application/x-www-form-urlencoded";
            hwr.Method = "POST";
            hwr.ContentLength = parms.Length;
            System.IO.StreamWriter sw = new System.IO.StreamWriter(hwr.GetRequestStream());
            sw.Write(parms);
            sw.Flush();
            sw.Close();
            System.Net.HttpWebResponse hws = (System.Net.HttpWebResponse)hwr.GetResponse();
            System.IO.StreamReader sr = new System.IO.StreamReader(hws.GetResponseStream());
            response = sr.ReadToEnd();
            hws.Close();
            return true;
        }
        catch (Exception)
        {
            response = "";
            error();
            return false;
        }
    }

    private int getDirectory()
    {
        if (issuerid != null && lastcheck.AddDays(1).CompareTo(DateTime.Now) >= 0)
            return 0;
        if (!send("DirectoryRequest"))
            return -1;
        string search = parse("directory");
        if (string.IsNullOrEmpty(search))
        {
            error();
            return -2;
        }
        string[] iss = search.Replace("<issuer>", "").Split(new string[] { "</issuer>" }, StringSplitOptions.RemoveEmptyEntries);
        issuerid = new string[iss.Length];
        issuername = new string[iss.Length];
        for (int i = 0; i < iss.Length; i++)
        {
            issuerid[i] = parse(iss[i], "issuerid");
            issuername[i] = parse(iss[i], "issuername");
        }
        lastcheck = DateTime.Now;
        return 0;
    }

    // DirectoryRequest
    public int DirectoryRequest(bool test, out string select)
    {
        int ex;

        select = "<select id=\"sisowbank\" name=\"issuerid\">";
        ex = getDirectory();
        if (ex < 0)
            return ex;
        for (int i = 0; i < issuerid.Length; i++)
        {
            select += "<option value=\"" + issuerid[i] + "\">" + issuername[i] + "</option>";
        }
        select += "</select>";
        return 0;
    }

    // DirectoryRequest
    public int DirectoryRequest(bool test, out string[] issuers)
    {
        int ex;

        issuers = null;
        ex = getDirectory();
        if (ex < 0)
            return ex;
        issuers = new string[issuerid.Length * 2];
        for (int i = 0; i < issuerid.Length; i++)
        {
            issuers[i * 2] = issuerid[i];
            issuers[i * 2 + 1] = issuername[i];
        }
        return 0;
    }

    // compute SHA1
    private static string GetSHA1(string key)
    {
        System.Security.Cryptography.SHA1Managed sha = new System.Security.Cryptography.SHA1Managed();
        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
        byte[] bytes = sha.ComputeHash(enc.GetBytes(key));
        //string sha1 = System.BitConverter.ToString(sha1).Replace("-", "");
        string sha1 = "";
        for (int j = 0; j < bytes.Length; j++)
            sha1 += bytes[j].ToString("x2");
        return sha1;
    }

    // TransactionRequest
    public int TransactionRequest()
    {
        trxId = issuerUrl = "";
        if (string.IsNullOrEmpty(merchantId))
            return -1;
        if (string.IsNullOrEmpty(merchantKey))
            return -2;
        if (string.IsNullOrEmpty(purchaseId))
            return -3;
        if (amount < 0.45)
            return -4;
        if (string.IsNullOrEmpty(description))
            return -5;
        if (string.IsNullOrEmpty(returnUrl))
            return -6;
        if (string.IsNullOrEmpty(issuerId) && string.IsNullOrEmpty(payment))
            return -7;
        if (string.IsNullOrEmpty(entranceCode))
            entranceCode = purchaseId;
        string sha1 = GetSHA1(purchaseId + entranceCode + (amount * 100).ToString() + shopId + merchantId + merchantKey);
        if (!send("TransactionRequest", "shopid", shopId, "merchantid", merchantId, "payment", payment, "issuerid", issuerId, "purchaseid", purchaseId, 
            "amount", (amount * 100).ToString(), "description", description, "entrancecode", entranceCode, "returnurl", returnUrl,
            "cancelurl", cancelUrl, "callbackurl", callbackUrl, "notifyurl", notifyUrl, "sha1", sha1))
            return -8;
        trxId = parse("trxid");
        if (string.IsNullOrEmpty(trxId))
        {
            error();
            return -2;
        }
        issuerUrl = System.Web.HttpUtility.UrlDecode(parse("issuerurl"));
        return 0;
    }

    private int GetStatus()
    {
        status = parse("status");
        if (string.IsNullOrEmpty(status))
        {
            error();
            return -5;
        }
        timeStamp = DateTime.Parse(parse("timestamp"));
        amount = long.Parse(parse("amount")) / 100.0;
        consumerAccount = parse("consumeraccount");
        consumerName = parse("consumername");
        consumerCity = parse("consumercity");
        purchaseId = parse("purchaseid");
        description = parse("description");
        entranceCode = parse("entrancecode");
        return 0;
    }

    // StatusRequest
    public int StatusRequest()
    {
        if (string.IsNullOrEmpty(merchantId))
            return -1;
        if (string.IsNullOrEmpty(merchantKey))
            return -2;
        if (string.IsNullOrEmpty(trxId))
            return -3;
        string sha1 = GetSHA1(trxId + shopId + merchantId + merchantKey);
        if (!send("StatusRequest", "shopid", shopId, "merchantid", merchantId, "trxid", trxId, "sha1", sha1))
            return -4;
        return GetStatus();
    }

    // StatusRequest
    public int StatusRequest(string trxid)
    {
        if (string.IsNullOrEmpty(merchantId))
            return -1;
        if (string.IsNullOrEmpty(merchantKey))
            return -2;
        if (string.IsNullOrEmpty(trxid))
            return -3;
        trxId = trxid;
        string sha1 = GetSHA1(trxId + shopId + merchantId + merchantKey);
        if (!send("StatusRequest", "shopid", shopId, "merchantid", merchantId, "trxid", trxId, "sha1", sha1))
            return -4;
        return GetStatus();
    }
}
}

NEW VB CODE

Namespace sisow
Public Class Sisow
    Private Shared issuerid As String()
    Private Shared issuername As String()
    Private Shared lastcheck As DateTime

    Private response As String

    ' Merchant data
    Public merchantId As String
    Public merchantKey As String
    Public shopId As String
    ' voor toekomstige doeleinden
    ' Transaction data
    Public payment As String
    ' empty=iDEAL; ideal=iDEAL; sofort=DIRECTebanking; mistercash=MisterCash
    Public issuerId As String
    ' mandatory; sisow bank code
    Public purchaseId As String
    ' mandatory; max 16 alphanumeric
    Public entranceCode As String
    ' max 40 strict alphanumeric (letters and numbers only)
    Public description As String
    ' mandatory; max 32 alphanumeric
    Public amount As Double
    ' mandatory; min 0.45
    Public notifyUrl As String
    Public returnUrl As String
    ' mandatory
    Public cancelUrl As String
    Public callbackUrl As String

    ' Status data
    Public status As String
    Public timeStamp As DateTime
    Public consumerAccount As String
    Public consumerName As String
    Public consumerCity As String

    ' Result/check data
    Public trxId As String
    Public issuerUrl As String

    ' Error data
    Public errorCode As String
    Public errorMessage As String

    ' Status
    Public Const statusSuccess As String = "Success"
    Public Const statusCancelled As String = "Cancelled"
    Public Const statusExpired As String = "Expired"
    Public Const statusFailure As String = "Failure"
    Public Const statusOpen As String = "Open"

    Public Sub New(merchantid As String, merchantkey As String)
        Me.merchantId = merchantid
        Me.merchantKey = merchantkey
        shopId = ""
    End Sub

    ' voor toekomstige doeleinden
    Public Sub New(merchantid As String, merchantkey As String, shopid As String)
        Me.merchantId = merchantid
        Me.merchantKey = merchantkey
        Me.shopId = shopid
    End Sub

    Private Sub [error]()
        errorCode = parse("errorcode")
        errorMessage = System.Web.HttpUtility.UrlDecode(parse("errormessage"))
    End Sub

    Private Function parse(search As String) As String
        Return parse(response, search)
    End Function

    Private Function parse(xml As String, search As String) As String
        Dim start As Integer, [end] As Integer

        If (InlineAssignHelper(start, xml.IndexOf("<" & search & ">"))) < 0 Then
            Return Nothing
        End If
        start += search.Length + 2
        If (InlineAssignHelper([end], xml.IndexOf("</" & search & ">", start))) < 0 Then
            Return Nothing
        End If
        Return xml.Substring(start, [end] - start)
    End Function

    Private Function send(method As String, ParamArray keyvalue As String()) As Boolean
        Dim parms As String = ""
        Dim url As String = "https://www.sisow.nl/Sisow/iDeal/RestHandler.ashx/" & method
        Try
            Dim i As Integer = 0
            While i + 1 < keyvalue.Length
                If String.IsNullOrEmpty(keyvalue(i + 1)) Then
                    Continue While
                End If
                If Not String.IsNullOrEmpty(parms) Then
                    parms += "&"
                End If
                parms += keyvalue(i) & "=" & System.Web.HttpUtility.UrlEncode(keyvalue(i + 1))
                i += 2
            End While
            Dim hwr As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create(url), System.Net.HttpWebRequest)
            hwr.ContentType = "application/x-www-form-urlencoded"
            hwr.Method = "POST"
            hwr.ContentLength = parms.Length
            Dim sw As New System.IO.StreamWriter(hwr.GetRequestStream())
            sw.Write(parms)
            sw.Flush()
            sw.Close()
            Dim hws As System.Net.HttpWebResponse = DirectCast(hwr.GetResponse(), System.Net.HttpWebResponse)
            Dim sr As New System.IO.StreamReader(hws.GetResponseStream())
            response = sr.ReadToEnd()
            hws.Close()
            Return True
        Catch generatedExceptionName As Exception
            response = ""
            [error]()
            Return False
        End Try
    End Function

    Private Function getDirectory() As Integer
        If issuerid IsNot Nothing AndAlso lastcheck.AddDays(1).CompareTo(DateTime.Now) >= 0 Then
            Return 0
        End If
        If Not send("DirectoryRequest") Then
            Return -1
        End If
        Dim search As String = parse("directory")
        If String.IsNullOrEmpty(search) Then
            [error]()
            Return -2
        End If
        Dim iss As String() = search.Replace("<issuer>", "").Split(New String() {"</issuer>"}, StringSplitOptions.RemoveEmptyEntries)
        issuerid = New String(iss.Length - 1) {}
        issuername = New String(iss.Length - 1) {}
        For i As Integer = 0 To iss.Length - 1
            issuerid(i) = parse(iss(i), "issuerid")
            issuername(i) = parse(iss(i), "issuername")
        Next
        lastcheck = DateTime.Now
        Return 0
    End Function

    ' DirectoryRequest
    Public Function DirectoryRequest(test As Boolean, ByRef [select] As String) As Integer
        Dim ex As Integer

        [select] = "<select id=""sisowbank"" name=""issuerid"">"
        ex = getDirectory()
        If ex < 0 Then
            Return ex
        End If
        For i As Integer = 0 To issuerid.Length - 1
            [select] += "<option value=""" & issuerid(i) & """>" & issuername(i) & "</option>"
        Next
        [select] += "</select>"
        Return 0
    End Function

    ' DirectoryRequest
    Public Function DirectoryRequest(test As Boolean, ByRef issuers As String()) As Integer
        Dim ex As Integer

        issuers = Nothing
        ex = getDirectory()
        If ex < 0 Then
            Return ex
        End If
        issuers = New String(issuerid.Length * 2 - 1) {}
        For i As Integer = 0 To issuerid.Length - 1
            issuers(i * 2) = issuerid(i)
            issuers(i * 2 + 1) = issuername(i)
        Next
        Return 0
    End Function

    ' compute SHA1
    Private Shared Function GetSHA1(key As String) As String
        Dim sha As New System.Security.Cryptography.SHA1Managed()
        Dim enc As New System.Text.UTF8Encoding()
        Dim bytes As Byte() = sha.ComputeHash(enc.GetBytes(key))
        'string sha1 = System.BitConverter.ToString(sha1).Replace("-", "");
        Dim sha1 As String = ""
        For j As Integer = 0 To bytes.Length - 1
            sha1 += bytes(j).ToString("x2")
        Next
        Return sha1
    End Function

    ' TransactionRequest
    Public Function TransactionRequest() As Integer
        trxId = InlineAssignHelper(issuerUrl, "")
        If String.IsNullOrEmpty(merchantId) Then
            Return -1
        End If
        If String.IsNullOrEmpty(merchantKey) Then
            Return -2
        End If
        If String.IsNullOrEmpty(purchaseId) Then
            Return -3
        End If
        If amount < 0.45 Then
            Return -4
        End If
        If String.IsNullOrEmpty(description) Then
            Return -5
        End If
        If String.IsNullOrEmpty(returnUrl) Then
            Return -6
        End If
        If String.IsNullOrEmpty(issuerId) AndAlso String.IsNullOrEmpty(payment) Then
            Return -7
        End If
        If String.IsNullOrEmpty(entranceCode) Then
            entranceCode = purchaseId
        End If
        Dim sha1 As String = GetSHA1(purchaseId & entranceCode & (amount * 100).ToString() & shopId & merchantId & merchantKey)
        If Not send("TransactionRequest", "shopid", shopId, "merchantid", merchantId, "payment", _
         payment, "issuerid", issuerid, "purchaseid", purchaseId, "amount", _
         (amount * 100).ToString(), "description", description, "entrancecode", entranceCode, "returnurl", _
         returnUrl, "cancelurl", cancelUrl, "callbackurl", callbackUrl, "notifyurl", _
         notifyUrl, "sha1", sha1) Then
            Return -8
        End If
        trxId = parse("trxid")
        If String.IsNullOrEmpty(trxId) Then
            [error]()
            Return -2
        End If
        issuerUrl = System.Web.HttpUtility.UrlDecode(parse("issuerurl"))
        Return 0
    End Function

    Private Function GetStatus() As Integer
        status = parse("status")
        If String.IsNullOrEmpty(status) Then
            [error]()
            Return -5
        End If
        timeStamp = DateTime.Parse(parse("timestamp"))
        amount = Long.Parse(parse("amount")) / 100.0
        consumerAccount = parse("consumeraccount")
        consumerName = parse("consumername")
        consumerCity = parse("consumercity")
        purchaseId = parse("purchaseid")
        description = parse("description")
        entranceCode = parse("entrancecode")
        Return 0
    End Function

    ' StatusRequest
    Public Function StatusRequest() As Integer
        If String.IsNullOrEmpty(merchantId) Then
            Return -1
        End If
        If String.IsNullOrEmpty(merchantKey) Then
            Return -2
        End If
        If String.IsNullOrEmpty(trxId) Then
            Return -3
        End If
        Dim sha1 As String = GetSHA1(trxId & shopId & merchantId & merchantKey)
        If Not send("StatusRequest", "shopid", shopId, "merchantid", merchantId, "trxid", _
         trxId, "sha1", sha1) Then
            Return -4
        End If
        Return GetStatus()
    End Function

    ' StatusRequest
    Public Function StatusRequest(trxid__1 As String) As Integer
        If String.IsNullOrEmpty(merchantId) Then
            Return -1
        End If
        If String.IsNullOrEmpty(merchantKey) Then
            Return -2
        End If
        If String.IsNullOrEmpty(trxid__1) Then
            Return -3
        End If
        trxId = trxid__1
        Dim sha1 As String = GetSHA1(trxId & shopId & merchantId & merchantKey)
        If Not send("StatusRequest", "shopid", shopId, "merchantid", merchantId, "trxid", _
         trxId, "sha1", sha1) Then
            Return -4
        End If
        Return GetStatus()
    End Function
    Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
        target = value
        Return value
    End Function
End Class
End Namespace
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:20:46+00:00Added an answer on May 30, 2026 at 9:20 am

    You have problems because VB.NET is case-insensitive, whereas C# isn’t.

    This means that where, say, two variables are defined with similar names differing only in case – for instance issuerId and issuerid – they are distinct in C#, but considered the same in VB.NET.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have almost completed an ASP.NET webforms website using jQuery Mobile. I am stuck
Some development skills, like refactoring operations, feel like they have an almost unlimited pontential
I have almost completed my Android application so am considering ways of distributing the
I have been working within another question on this site and have almost completed
I am running Ruby on Rails 3 and I have almost completed my application.
Here almost we have completed the functionality.When we clicking on add button of each
I've almost completely installed Boost, but I have a problem with how to set
I have almost the worst spec in the world. An application that exists and
I have almost 800 MB and over 31,000 files in hundreds of subfolders at
I admit that I have almost none experience of unittesting. I did a try

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.