How Do I Post and then redirect to an external URL from ASP.Net?

前端 未结 6 899
说谎
说谎 2021-02-05 01:23

ASP.NET server-side controls postback to their own page. This makes cases where you want to redirect a user to an external page, but need to post to that page for some reason (

6条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 02:06

    If you're using ASP.NET 2.0, you can do this with cross-page posting.

    Edit: I missed the fact that you're asking about an external page. For that I think you'd need to have your ASP.NET page gen up an HTML form whose action is set to the remote URL and method is set to POST. (Using cross-page posting, this could even be a different page with no UI, only hidden form elements.) Then add a bit of javascript to submit the form as soon as the postback result was received on the client.

提交回复
热议问题