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 8360303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:25:18+00:00 2026-06-09T11:25:18+00:00

I have inherited some C# code. This code needs to upload a picture to

  • 0

I have inherited some C# code. This code needs to upload a picture to a web service. This code saves the bytes of picture into byte[] called ImageBytes. To ensure the greatest portability, I want to first encode the ImageBytes into a base 64 encoded string. I believe the following code is doing that, however, I’m not sure. Can someone please verify if my assumption is correct?

StringBuilder sb = new StringBuilder();
this.ImageBytes.ToList<byte>().ForEach(x => sb.AppendFormat("{0}.", Convert.ToUInt32(x)));

Is this code converting my byte[] into a base 64 encoded string?

Thank you!

  • 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-06-09T11:25:21+00:00Added an answer on June 9, 2026 at 11:25 am

    use methods System.Convert.ToBase64String() and System.Convert.FromBase64String()
    for example

    public static string EncodeTo64(string toEncode)
    {
       byte[] toEncodeAsBytes = Encoding.ASCII.GetBytes(toEncode);
       return Convert.ToBase64String(toEncodeAsBytes);
    }
    
    public static string DecodeFrom64(string encodedData)
    {
      byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
      return Encoding.ASCII.GetString(encodedDataAsBytes);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently inherited some Java code and need to integrate it into a
I have inherited some code: Process p = new ProcessBuilder(/bin/chmod, 777, path).start(); p.waitFor(); Basically,
I have inherited some code (from zip file) from a developer and git initialzed,
I have inherited some HTML code and have been asked to align the two
I have inherited some code from a guy whose favorite past time was to
I have inherited some code that is not working as I think it should:
I have inherited a VB.net web app that I'm making some changes on. I'm
I have inherited some verbose, repetitious code that I am trying to refactor. The
I inherited some legacy Java (1.4) code and this design decision appears regularly. I
I have inherited some Silverlight\WCF code and now need to implement some new features.

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.