Jeremy
Jeremy

Reputation: 46322

HTML & Url Decoding on a stream

The HttpUtility.UrlDecode and HttpUtility.HtmlDecode methods both take strings as input parameters, meaning the entire encoded document needs to be loaded into memory to perform the decoding operation. Are there functions available that can accept streams and output streams, so that decoding doesn't have to load the entire chunk of data into memory?

Upvotes: 2

Views: 306

Answers (1)

Alexei Levenkov
Alexei Levenkov

Reputation: 100527

No, there is no functions in .Net framework that will HtmlEncode/Decode for large streams/buffers.

Such function does not make much sense for UrlDecode/Encode as generally urls are short enough (i.e. there is about 2K length restriction in IE).

If implementing decoding yourself make sure to be careful when encoded symbol falls on block boundary. For encoding see if any of Razor/ASPX rendering methods can be reused for Html Encode.

Upvotes: 1

Related Questions