byte array to string problem

Hi all, 
      I'm trying to print out a byte [] using the .ToString() method. But it just prints out "System.byte[]".  Why is it like this???

0
kakusei
6/1/2005 1:33:27 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

1 Replies
441 Views

Similar Articles

[PageSpeed] 59

Normally types print out their type name in ToString method , that's the default implementation, unless there are some for which converting to string makes more sense (such as integer to string).With byte array, the implementation comes from the base class System.Array (base class for all arrays).
 
If you want to print the byte array, you can loop it through and generate the string yourself from individual byte values. Or you can use Convert class to convert it to base-64 string etc etc however I think you'd just want them out as individual values.
Thanks,

Teemu Keiski
Finland, EU
0
joteke
6/1/2005 1:43:49 PM
Reply:

Similar Artilces:

Problems converting a byte array to string
Hello,i need some help on this one, i have a byte array with some information i get from an UDP serverhere is an example of what my code looks like Dim b() As Byte = {0, 179, 68, 252, 255, 128, 234, 244} Dim s As String = System.Text.Encoding.Default.GetString(b) Debug.WriteLine(s) Now if notice the first byte is 0, when this happens my result string will be nothingAny ideas on how to fix this?Thank you   I notice you're using encoding Default... 0 is often a string terminator, which could be your issue. Maybe try some of the other encodings until you find one that fi...

How to get the string array that starts with prefixtext
 Helloo, i am using a web service to autocomplete a textbox The database contains a keywords column ..each colum contains more than 1 keywords  LIKE "INDIA WORLD IRAQ" So i need to use RegEx to split each keywords.But How can i extract only strings that starts with the prefixtext into an array??Please HelppI hav put my code below   1 public string[] GetKeywords(string prefixText, int count) 2 { 3 // int count = 10; 4 string connString = ConfigurationManager.ConnectionStrings["dnas_newConnectionString...

10.5 WebServices .NET translate BASE64 string to BYTE array
Once more into the breach, dear friends,... I have a webservice that wants me to send an AUTHENTICATION key code declared in WSDL as type BASE64binary. The PBCRYPTO.GenerateMessageDigest() function has returned my authentication code HASH as a STRING that is BASE64. The .NET PROXY casts my base64 binary variable as a BYTE array. I tried to send the ASCII decimal of each character to the BYTE array, but that is not right. I have information on how to translate base64 to ASCII. Do I want to do this? Then use the ASCII decimal value for the byte array? I also see a new GETBYTE and SET...

RSA Encryption
Here is my goal:1. Take a string2. Encrypt it 3. Pass it as a parameter in the QueryString4. Decrypt it The value starts as a string, then is converted to a byte[] and then encrypted.  The resulting byte[] is converted to a string and send as a parameter.  The recieving page decrypts the string (creates a byte[], decrypts to a new byte[], and the value is finally parsed for its values) I am using http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemsecuritycryptographyrsacryptoserviceproviderclasstopic.asp with a small modification t...

hi , i have a littel problem with arrays, i want use with replace function of string and i get a error
hi in php its worked well, but when i try to convert it to asp.net i get this error i try to replace all the characters in field that in array aa with the characters that in abstring[] ab = new string[] { "5", "4", "3", "2", "1" }; string[] aa = new string[] { "a", "b", "c", "d", "e" }; string field = "abcdabcs"; Response.Write(field.Replace(ab, aa).ToString()); the result will need to be : ------------------------------------------------------ 54325432 --------------------...

How to copy strings in array of strings....I am getting some errors....
Hi, I want to display all the file names that are present in a specified directory....say "C:\data" in a GridView for that I am using the following: Imports System.IOPartial Class _Default Inherits System.Web.UI.PageProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFileSize As String = ""Dim di As New IO.DirectoryInfo("C:\data") Dim aryFi As IO.FileInfo() = di.GetFiles()Dim fi As IO.FileInfo For Each fi In aryFi strFileSize = (Math.Round(fi.Length / 1024)).ToString() Response.Write(fi.Name)...

string to byte array
Hi all, I'm currently building a small app which uses 3DES encryption, it works all nicely, but would like to do a bit a fix upcurrently the code behind has the code as followDim key As Byte() = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22.2, 23, 24}and the web.config is as follows    <appSettings>    <add key="key" value="1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22.2, 23, 24"/>    </appSettings> I am trying to call the values {1, 2 ,...

problems parsing array or associative array (of strings) in from RenderScript
I can not find a way for my atlas server RendScript to contain a subnode representing an array or associative array and pass this information to the client object (successfully at least). Atlas seems to want a sophisticated object contained as array elements. Is there anyway to have an array (from RenderScript) parse easliy by atlas client object? The sample RendScript code here:  protected override void RenderScript(ScriptTextWriter writer, Control targetControl) {   Foo foo = targetControl as Foo;   FooExtenderProperties properties = GetTargetPro...

Problem accessing an array from a string which contains the name of the array
I am trying to access the elements of an array by using javascript on the client side.  The array is registered to the page using the ClientScript.RegisterArrayDeclaration function from the server side. The problem is that I don't know what the name of the array is going to be at design time because it is created dynamically from my server side script so I can't just have a line in my javascript code that says for example: MyArray5[0] I have to have a variable that turns out to be a string containing the name of the array using code similar to: var myArrayName&nbs...

Problem Getting Started
In have run the 1317set.bat file and still get the following error: Unable to get your db version please run version script against your db and restart your web application (go to update/scripts/ folder and run 1317set.bat). Any help to get me started would be much appreciated.www.creativenrg.co.uk | www.therivercard.com Have you checked your connection string? This is sometimes caused by a faulty db connection. I am new to Rainbow and get the same error when trying to run it for the first time. Does not matter which of the following I comment out in web.config: <!-...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework
 Table A: COUNTRY_LOOKUP COUNTRY_ID   smallintclustered, unique, primary key located on PRIMARY    COUNTRY_ID TABLE B: COUNTRY_MODE_RULES CARRIER_ID    intMODE_RULE_TYPE_ID    intORIG_COUNTRY_ID    smallintDEST_COUNTRY_ID    smallint clustered, unique, primary key located on PRIMARY    CARRIER_ID, MODE_RULE_TYPE_ID, ORIG_COUNTRY_ID, DEST_COUNTRY_IDThere is a foreign key relationship from COUNTRY_MODE_RULES to COUNTRY_LOOKUPORIG_COUNTRY_IDREFERENCES .COUNTRY_LOOKUP (COUNTRY_ID)DEST_CO...

How to append string to Response.OutputStream after string converted to byte array
Hi, I am trying to append string to Response.OutputStream property in PostRequestHandlerExecute event handler inside custom httpmodule. The goal of this implementation is to append string to output stream after the page is rendered when the response object is still held on the server. The pseudo code I wrote is the following: private void PostRequestHandlerExecute(object sender, EventArgs e) { HttpApplication application = ( HttpApplication ) sender; HttpContext context = application.Context;   string s = "This is test!"; byte[] buffer = Encoding.ASCII.GetByt...

Problem with String[] Arrays
What the problem with the code below, the red part is complaining that Argument '1': cannot convert from 'string[]' to 'string'Why?public static void Main(string[] args)        {            string[] FilesToBeZipped = { "C:\\zip\\Roger.doc", "C:\\zip\\Roger2.doc", "C:\\zip\\Roger3.doc" };            RunZip(FilesToBeZipped, "Obinna.Zip");        }            &nbs...

Byte Array to string
How do you covert a bit array to a string? This is what I did and it didn't work: Dim hashedPassword As Byte() Dim encoder As New UTF8Encoding() hashedPassword = md5Hasher.ComputeHash(encoder.GetBytes(pwd.Value)) Dim clientStr As String Dim uniConvert As UnicodeEncoding = New UnicodeEncoding() Response.Write(uniConvert.GetString(hashedPassword)) This is what I got: ???????? Does anyone have any ideas? Phillip That is because you are changing encodings. Use the UTF8Encoding for both. Also you don't have to create a new enc...

Web resources about - byte array to string problem - asp.net.getting-started

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

Chris Christie has a problem with the presumption of innocence
Last night’s debate was more or less dominated by Ted Cruz and Donald Trump, but that doesn’t mean that it wasn’t riddled with deeply problematic ...

Is there a problem with Apple Music?
... page on my iOS device, the song or playlist began playback. In my case, the signup page didnt return until I force quit the app. The problem ...

There's one big problem with this crucial piece of evidence in favor of Steven Avery on 'Making a Murderer' ...
One of the strongest pieces of trial evidence in favor of "Making a Murderer" subject Steven Avery was the vial of his blood from a previous ...

Donald Trump: 'Ted Cruz Is Very Nervous About 'Birther Problem'
Donald Trump did an interview Wednesday night on CNN with Erin Burnett and after he spent a good amount of time dissing Nikki Haley's speech, ...

Jimmy Fallon’s Boss: He Doesn’t Have A Drinking Problem
Jimmy Fallon’s Boss: He Doesn’t Have A Drinking Problem

Hours-Long Delays Affected N,Q,R, B and D Lines Due to Signal Problems: MTA
Signal problems citywide&nbsp;delayed the lines, the agency said.

Free Basics, net neutrality, and the problem with charity
This must have been a pretty bad year for Mark Zuckerberg. He thought he'd be a hero, but now he's a pariah. Why?

Belarus's Russia Problem
BY VALERY KAVALEUSKI - Belarusian president Alexander Lukashenko’s diplomatic team is scrambling to normalize relations with the West. However, ...

Carter says ‘navigation error’ – not mechanical problem – put US boats in Iranian waters
Carter says ‘navigation error’ – not mechanical problem – put US boats in Iranian waters

Resources last updated: 1/17/2016 2:40:57 AM