ASP.NET MVC Alter Markup before Output
Posted
by youwhut
on Stack Overflow
See other posts from Stack Overflow
or by youwhut
Published on 2010-03-15T11:25:00Z
Indexed on
2010/03/15
11:29 UTC
Read the original article
Hit count: 371
Hi,
Excuse my limited knoweldge here.
In the past I have used Steve Sanderson's method to HTML encode by default at runtime: http://blog.stevensanderson.com/2007/12/19/aspnet-mvc-prevent-xss-with-automatic-html-encoding/
I have a need to alter img src
and a href
attributes before they are spat out in the user's browser. There is a solution using JavaScript but this is not ideal for several reasons. Intercepting the compiler is not an option because of unnecessarily using Response.Write
for trivial HTML.
Is there something I can do with HTTP modules or the view engine?
Any thoughts?
Cheers.
© Stack Overflow or respective owner