We help IT Professionals succeed at work.
Get Started

C# - Convert URL to plain text

Bach Nguyen
Bach Nguyen asked
on
630 Views
Last Modified: 2015-08-11
Hi,

I am trying to convert an URL format to plain text format by this way:

 string fileTxt = File.ReadAllText("test1.txt");

  MessageBox.Show(Uri.UnescapeDataString(fileTxt)); --> It doesn't work, it shows: oJ\x2BkTRbYHjeME72JTd\x2F\x2Fnb\x2BKt0RWeAmk8Gzw7dOc\x2FAM\x3D:1438850410112:hEj6agVToFMpYj7MufF9Qg\x3D\x3D

The content of "test1.txt": oJ\x2BkTRbYHjeME72JTd\x2F\x2Fnb\x2BKt0RWeAmk8Gzw7dOc\x2FAM\x3D:1438850410112:hEj6agVToFMpYj7MufF9Qg\x3D\x3D

If I use directly the string: MessageBox.Show(Uri.UnescapeDataString("oJ\x2BkTRbYHjeME72JTd\x2F\x2Fnb\x2BKt0RWeAmk8Gzw7dOc\x2FAM\x3D:1438850410112:hEj6agVToFMpYj7MufF9Qg\x3D\x3D")); ---> It works.


Could you let me know how to make string fileTxt = File.ReadAllText("test1.txt"); work?

Thank you!
Comment
Watch Question
Software Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE