问题
I have an ASP.NET Core 2.1 Razor app with two menu items that are active prior to login. I want to transfer (redirect?) to a different web site when either of the menu items is clicked. I've tried a Redirect, as shown below, but the current url is added to the string I specify.
public IActionResult OnGet()
{
string url = "www.google.com";
return Redirect(url);
}
How can I do this?
回答1:
It didn't take long to get the answer that was right in front of me anyway. Thanks to CodeCaster and Chris Pratt. Using a fully-qualified URL does work correctly.
public IActionResult OnGet()
{
string url = "https://www.google.com";
return Redirect(url);
}
来源:https://stackoverflow.com/questions/50875794/redirect-user-to-page-in-a-different-asp-net-core-razor-web-site