I wonder if it is possible to find and replace in a .asp (classic) page on the server automitically?
This is what I want to do:
In classic asp I copy a folder on my server and paste it in another place on my server(this works as it should), in that folder I have 3 .asp pages and in those pages I want to “find and replace” userId=1 to some other userid that I get from my database.
Is this possible with classic asp or jquery?
Thanks for any input.
I’m afraid your question is sightly vague. When your trying to find replace strings, are you looking to literally replace “userId=1” with “userId=X” where X is a value looked up in a database?
If so you are possibly thinking about the problem wrong, instead of trying to find replace files, can’t you write a function that communicates with the DB and instead of trying to find/replace in files, then you would just use your function so
With myFunction returning the ID for the user. That way you don’t get into issues with some weird string replacements which you may or may not contextually know what they mean.
If you really want to do find replacements, then I would suggest you write a program that can hook into the
System.IO.FileSystemWatcherfunctions and watch a directory, then open the file, regex search it for your data and replace the values in. You can find a use of FileSystemWatercer here (Post 3).