2

I am doing following to convert Tempdata to ToBase64String but it showing me error. My tempdata have Byte Array.

Code on razor view:

var img = Convert.ToBase64String(TempData["Image"]);

Error:

The best overloaded method match for 'System.Convert.ToBase64String(byte[])' 
has some invalid arguments

I don't know what's the issue.

0

1 Answer 1

7

First of all u need to convert that TempData["Image"] into byte. So try this and let me know whether it is working for u or not..

 var img = Convert.ToBase64String((byte[])TempData["Image"]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.