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

  • Home
  • SEARCH
  • 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 6528807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:34:09+00:00 2026-05-25T09:34:09+00:00

I have a VBScript script which I would like to run in ASP.NET, is

  • 0

I have a VBScript script which I would like to run in ASP.NET, is there anyone who can help on rewriting this function in ASP.NET , C# , so that it returns the same algorithm of encryption? This was an ASP.NET Encryption function, converted for Classic ASP usage, but I need to get it working on the ASP.NET code.. How would this code look like in ASP.NET considering its using an ASP.NET Encryption method?

Public Function EncryptAES(ByVal sIn As String, ByVal sKey As String) As String
    Dim AES As New RijndaelManaged
    Dim ahashMD5 As New MD5CryptoServiceProvider()
    AES.Key = ahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
    AES.Mode = CipherMode.ECB
    Dim AESEncrypt As ICryptoTransform = AES.CreateEncryptor()
    Dim aBuffer As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(sIn)
    Return Convert.ToBase64String(AESEncrypt.TransformFinalBlock(aBuffer, 0, aBuffer.Length))
End Function

Public Function DecryptAES(ByVal sOut As String, ByVal sKey As String) As String
    Dim dAES As New RijndaelManaged
    Dim dahashMD5 As New MD5CryptoServiceProvider()
    dAES.Key = dahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey))
    dAES.Mode = CipherMode.ECB
    Dim dAESDecrypt As ICryptoTransform = dAES.CreateDecryptor()
    sOut = Replace(sOut, " ", "+", 1, -1, CompareMethod.Text)
    Dim daBuffer As Byte() = Convert.FromBase64String(sOut)
    Return System.Text.ASCIIEncoding.ASCII.GetString(dAESDecrypt.TransformFinalBlock(daBuffer, 0, daBuffer.Length))
End Function
  • 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-25T09:34:10+00:00Added an answer on May 25, 2026 at 9:34 am

    I have a Classic ASP script

    Man, this is pure .NET code. So converting .NET to .NET hardly makes sense.

    If you want to convert this VB.NET code to C#, here’s how it would look like:

    public string EncryptAES(string sIn, string sKey)
    {
        RijndaelManaged AES = new RijndaelManaged();
        MD5CryptoServiceProvider ahashMD5 = new MD5CryptoServiceProvider();
        AES.Key = ahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey));
        AES.Mode = CipherMode.ECB;
        ICryptoTransform AESEncrypt = AES.CreateEncryptor();
        byte[] aBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(sIn);
        return Convert.ToBase64String(AESEncrypt.TransformFinalBlock(aBuffer, 0, aBuffer.Length));
    }
    
    public string DecryptAES(string sOut, string sKey)
    {
        RijndaelManaged dAES = new RijndaelManaged();
        MD5CryptoServiceProvider dahashMD5 = new MD5CryptoServiceProvider();
        dAES.Key = dahashMD5.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(sKey));
        dAES.Mode = CipherMode.ECB;
        ICryptoTransform dAESDecrypt = dAES.CreateDecryptor();
        sOut = sOut.Replace(" ", "+");
        byte[] daBuffer = Convert.FromBase64String(sOut);
        return System.Text.ASCIIEncoding.ASCII.GetString(dAESDecrypt.TransformFinalBlock(daBuffer, 0, daBuffer.Length));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem with a simple vbScript. The script has to run
Does anyone have experience building a .NET test execution harness that can execute the
I have a VBScript script that looks like this: Const ForAppending = 8 Set
I have a VBScript function in my ASP.net Page I have a small test
I have a vbscript which does the following: Open an access 2003 database Run
I have a VBScript COM Component where I'm using Msxml2.FreeThreadedDOMDocument.4.0 however is there /
I have a couple of questions regarding VBScript and ASP Classic: What is the
I have a VBScript script that runs a second VBScript script. The second VBScript
I would like to create a shortcut on the desktop using VBScript code. I
is there any possiblity to get multiline string in classic asp (I think vbscript

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.