开发者

how to save HTML in byte[] as Image??? c#

i have HTML page source of website saved as String in string PageSource; i need to save it in SQL Database as Image开发者_JAVA百科 of type image. How to convert PageSource in byte[] and save it as Image in database.


You can use the following code to convert a string to a byte array, which can then be saved in a database image field.

var bytes = Encoding.Default.GetBytes(htmlString);

Use of image will be deprecated, consider using varbinary(max).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜