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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:31:42+00:00 2026-06-04T06:31:42+00:00

In Page1.aspx, I have byte[] byt = System.Text.Encoding.UTF8.GetBytes(TextBox1.Text); Response.Redirect(Page2.aspx?BytArray= + byt,false); The value of

  • 0

In Page1.aspx, I have

byte[] byt = System.Text.Encoding.UTF8.GetBytes(TextBox1.Text);
Response.Redirect("Page2.aspx?BytArray=" + byt,false);

The value of TextBox1 is “mnop”.

Now in Page2.aspx I have the below code

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {           
        var byteArray = System.Text.Encoding.UTF8.GetBytes(Request.QueryString["BytArray"]);

        var x1 = System.Convert.ToBase64String(byteArray, 0, byteArray.Length);

        var x2 = Encoding.UTF8.GetString(byteArray);
    }
}
  • x1 output is U3lzdGVtLkJ5dGVbXQ==

  • x2 output is System.Byte[]

But how to get “mnop” back ? What I am missing?

Even C#: How can I safely convert a byte array into a string and back? gave the answer as U3lzdGVtLkJ5dGVbXQ==

Thanks.

  • 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-04T06:31:45+00:00Added an answer on June 4, 2026 at 6:31 am

    You cannot send raw bytes as query string. Try Base64 encoding it instead:

    byte[] byt = System.Text.Encoding.UTF8.GetBytes(TextBox1.Text);
    string encoded = HttpUtility.UrlEncode(Convert.ToBase64String(byt));
    Response.Redirect("Page2.aspx?BytArray=" + encoded, false);
    

    and then retrieve it back:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {           
            byte[] byteArray = Convert.FromBase64String(Request.QueryString["BytArray"]);
            string value = System.Text.Encoding.UTF8.GetString(byteArray);
        }
    }
    

    But I really don’t see the point of the whole exercise of converting to byte arrays when you can directly send the string value of the text box as is (after url encoding it of course). If this is some form of a way to hide the real value from the user I hope you are well aware that Base64 is not encryption, it’s encoding.

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

Sidebar

Related Questions

a have two aspx pages page1.aspx and page2.aspx . i have an href in
I have an Asp .net page like this simple one http://issamsoft.com/app2/page1.aspx and I want
I have an ASPX (PictureGetter.aspx) That loads images and writes them to the response
I have a aspx suppose Page1.aspx in that I I am registering a web
I have an aspx page (page1.aspx) where I set a Session variable and then
I have a Default.aspx that redirects to a Page1.aspx. My ddl is loaded and
I have the following html snippet: <a href=page1.aspx class=title>page title goes here</a><br /> <span
Hello in my aspx page using MVC 3, I have the following code: <%Response.WriteFile(/Content/Bing.htm);
I have a web form (Page1.aspx) in which I am passing an ID as
To keep things simple, we have a few aspx pages... Page1.aspx - resets Session

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.