简体   繁体   中英

How to redirect user from controller to another domain

I'm trying to redirect the user to another website.domain.

Here's the controller:

public void LogOff(){...}

I tried Server.Transfer("www.google.fr") => Error executing child request for www.google.fr.

I tried Redirect("www.google.fr"); => no page loading

I don't know what to make...

You can redirect to any url using return Redirect() :

public ActionResult LogOff()
{

    return Redirect("http://www.google.fr");

}

System.Web.HttpContext.Current.Response.Redirect(" http://www.google.fr "); is the working solution for my problem!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM