问题
I've recently upgraded a page on our server from classic asp to asp.net
The page recieves postdata and saves it to a file. The page is used by many of our clients and the url (to the asp page) is hard coded into their software. This means that i cannot simply swap the old page out for the new one. I'm trying to find a way to redirect clients from the old url to the new one. I know you can do a simple redirect using IIS, but this does not cause the postdata to be redirected. I've tried setting the file to a 307 temporary redirect, this works when the data is in the formdata but other post requests such as ones using the msxml library do not work.
Basically i need to find a way in IIS to forward a post request from one page to another without losing any of the body.
回答1:
If the two pages are within the same application, you can use Server.Transfer. This just shifts the processing from the old page to the new one, and maintains all of the request data.
回答2:
The best way i found was to use the temporary redirect code in IIS, although this didn't work for postdata originating from the msxml library. In the end i had to write a COM library in .NET to do the hard work using the system.encoding libraries and then reference the COM library in asp
回答3:
You can always program (in asp.old) a loop that goes through all the form-data and insert a record with all the values in the database. You then redirect the user to your aspx-page with the id of the row in the database as a querystring parameter. Be careful if the form-data is sensitive, to apply some sort of security to make sure users wont "steal" others data by changing the querystring.
回答4:
Redirect Reference (IIS 6.0) http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/41c238b2-1188-488f-bf2d-464383b1bb08.mspx?mfr=true
来源:https://stackoverflow.com/questions/1178183/redirecting-postdata