Server.HTMLEncode and performance

M

Michael Gaillez

Hi,

I'm dynamically loading an assembly into an ASP.NET application. In the
control that I load from that dynamic assembly I've tried to use
Server.HTMLEncode but this results in a serious performance loss. Is there
anyone who knows why or is there an alternative for server.htmlencode
method? Without the server.htmlencode the thingy works very fine.

greetz

Michael
 
K

Kevin Spencer

The HtmlEncode mathod will work as fast as the length of the string you are
encoding. If the string is short, it will be fast. If the string is long, it
will be slow.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

Michael Gaillez

Ok that I can understand. But that is not the reason why I'm losing
performance in this application. If I'm doing exactly the same thing without
an dynamic assembly load it works pretty fast. If I use it with assembly
load it works very slow. So in my opinion the length doesn't really matter
in this case. But what I've found meanwhile is the httputility class were
the functionallity resides from. I will try that because then I don't have
to do this: "Page.Server....." . My guess is that this should do the trick
because reflection might not handle page.server very well.

greets

Michael
 
K

Kevin Spencer

The HttpUtility.HtmlEncode method will definitely work faster, as it is
static.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top