how to redirect to external url from c# controller

后端 未结 3 753
一整个雨季
一整个雨季 2020-12-02 17:54

I\'m using a c# controller as web-service.

In it I want to redirect the user to an external url.

How do I do it?

Tried:

System.Web.Ht         


        
3条回答
  •  感情败类
    2020-12-02 18:25

    If you are using MVC then it would be more appropriate to use RedirectResult instead of using Response.Redirect.

    public ActionResult Index() {
            return new RedirectResult("http://www.website.com");
        }
    

    Reference - https://blogs.msdn.microsoft.com/rickandy/2012/03/01/response-redirect-and-asp-net-mvc-do-not-mix/

提交回复
热议问题