Search and replace in *.aspx,*.ascx files when publishing a Webapplication
I'm attempting to replace a pattern in all my .aspx and .ascx file when I Publish my Webapplication.
When I am running the application locally, I don't car开发者_JAVA百科e about the replace. But as soon as I need to Publish the solution I need a sequence of characters, let's say "ABC", replaced with "DEF" in all my .aspx and .ascx files.
How would I go about performing this?
You should create a separate script, that goes through your folder searching and loading all your .aspx and .ascx files, open them and replace all the needed stuff. I don't know how to do it in asp, but in actionscript it would look like fileText = fileText.replace(/ABC/g,"DEF");
perl -p -i -e 's/ABC/EDF/g' *.aspx
perl -p -i -e 's/ABC/EDF/g' *.ascx
精彩评论