Mvc redirect to external url not working I will check with my colleague to see if we can/should I am using the new Razor Pages in ASP. location. Apr 25, 2017 · When ASP. If IsClientConnected is true, the code calls the Redirect method, and the client will view another page. Another way of passing data to the redirect target is by using flash attributes. Hope this helps. In this article, we will learn about these techniques and the code required to redirect a request in ASP. I ended up creating routes that matched the old routing system and then had it reconstruct the routes using the new routing system and perform a permanent redirect Jun 18, 2016 · In ASP. If the reply is helpful, please click Accept Answer and kindly upvote it. The middleware allows you to modify or rewrite incoming request URLs before they are processed by the routing system. I don't want to mess with the existing code, but use routing to execute some of the pages and redirect from others. We will understand all redirect action results step-by-step with examples. However, in the context of LWC and the Salesforce Lightning Aug 25, 2022 · I have a blazor-server website and I am trying to redirect the user away from my website to an external one f. Rewrite NuGet package to your project. Redirect ToPage Method In this article Definition Overloads RedirectToPage () RedirectToPage (Object) Show 6 more Definition Sep 12, 2024 · In standard web development, window. NET Core MVC. IsLocalUrl checks if the URL you want to redirect to is local to your application (starts with / or ~ and does not contain a full domain). This article overviews redirect action results in ASP. 8. It should Aug 24, 2011 · When a controller method redirect to any url, the framework automatically appends all the model attributes in url query string even if those attributes are stored in session. If you have a multi-step form, you might want to have EnrollPatient submit the form (the form's action) to EnrollPatientPageTwo so that action will get called with the first page's data. Aug 5, 2013 · In a Spring Controller Action, I am using the following statement to redirect to an external URL: String redirectUrl = "www. I'm using a c# controller as web-service. NET Core MVC project Apr 12, 2014 · public ActionResult ExternalLogin(string provider, string returnUrl) { // Request a redirect to the external login provider return new ChallengeResult(provider, Url. Apr 7, 2022 · Redirecting a request means returning a response with redirect status code (3xx) and a redirect URL in the Location header. Dec 21, 2019 · Please advice how to redirect to external url from Post method using . NET Core MVC, RedirectResult is a type of action result that provides a way to redirect the user’s browser to a new URL. Redirect but it didn't work. So I stash a url in the session, redirect to the page from mvcSiteMap, hit the page run this javas. RedirectToAction will issue a redirect. I want to do this in client app in razor page. My task is to change the website to use OpenID Connect to connect to an external provider to authenticate the user and return a… Jun 20, 2020 · Learn several ways how to redirect logged-in users from the login page using Spring Security. Creating links in ASP. 36. Sep 2, 2023 · Luckily, ASP. So, let's dive right in! 💻🌊 May 23, 2018 · ASPRunner. com. If you need to redirect to another controller action that belongs to your site it would be better to use this: Aug 28, 2023 · My scenario was that I needed to do a custom redirect for login/logout scenario to an OIDC server. How do I accomplish this? I should mention the views are created, tested, and functioning. Sep 8, 2019 · Learn how to redirect to a page in ASP. I've recently came across this post about redirect and url_for which only works for internal URLs, and this post that had a similar question about external URLs with parameters, but I cannot use HTTP code 307 for the LTI product I'm working on. I was able to confirm that I can add any MVC view or even RazorPage and it works without issues. com) in a new browser window / tab from MVC controller button click based on the condition's of success/failure. I need the same thing with ASP. Jul 31, 2013 · I want the redirect to always redirect to the URL specified, whether it has a valid protocol in it or not and do not want to redirect to a view. 0 using JavaScript/jQuery/Ajax. Redirect seems to be stuck in a loop and RedirectToPage insists on confining me to the Razor-World, rather than popping a new browser tab (target=_blank) with my Links. Current. Whenever your application logic redirects to a specified URL, you must verify that the redirection URL hasn't been tampered with. Dec 17, 2022 · Is it possible to build an ASP. Later on I need to redirect to this same Action from a Controller. Transfer performs a redirection on the server itself—so the client never knows the redirect occurred. Apr 24, 2023 · Hum, it not clear why people are suggesting re-write rules and all kinds of mumbo-jumbo? Friendly URL's once turned on "just work". Yes, you will have one route for each action method. Jun 30, 2017 · The current method I have adds the Url link to the localhost link. 👍. NET Core MVC In ASP. NET General questions Open a url in a new window or tab after record added Creates a RedirectResult object that redirects (Status302Found) to the specified url. Net core Mvc services that connect to a Identity server built using IdentityServer4. It should be this part endpoints. NET Core is a cross-platform, open source, lean, fast, and modular framework Jul 24, 2024 · By using these methods, you can easily redirect users to different URLs within your ASP. This view suppose to show a list of hyperlinks, each pointing to an external URL. In your configuration file, you can have something like this: 4 days ago · redirect to login page with returnUrl does not work after login #3187 0 yasin. Cookies. The goal is for the user to click one of these links and have their browser open a new tab with the selected URL. Open web. When the user clicks the button I want them redirected to a data entry view. Jul 9, 2016 · You can redirect to an external URL by using Redirect Method() or via Json Result. instead of having to write /swagger, I'd like to simply redirect to the swagger page. Additionally, it allows the return URL to be preserved so that the user can be redirected back to the originally requested page after successful authentication. NET Core MVC Action Method returns different type of Action Result like Content, Redirect, File, HTTP Status Code. The Redirect method is intended to be used to redirect to external urls of your site and by passing it an absolute url. com/") via ASP. NET Core There will always be a need for redirection to another URL based on some conditions like redirecting a user to the login page if there is no valid session, redirecting users to the Q3. see my method : Creates a RedirectResult object that redirects to the specified URL. Made changes to make the request from the razor view directly to the controller action w/o going through js file solved the problem for me. The MVC has different types of Action Results. NET Core page to forward all HTTP request (query string/headers/post data) to an external URL and then captures response and send it back to client? For example: I make request (HttpRequest) to… Jan 31, 2024 · Learn how to create a redirect in IIS 10 for URLs on the same network, including DNS server configuration and A record setup. Additionally, the logout URL is not currently available for the primary admin user (root account) and external users. Action("ExternalLoginCallback", "Account", new { ReturnUrl = returnUrl })); } Which I have verified via debugging gets into the ExecuteResult method of the ChallengeResult class: Jul 19, 2022 · You can not redirect to a controller from your model class. com created 3 years ago return redirect ()-> away ('https://www. Here's how you can perform URL rewriting in ASP. Net core 2 Now I need to redirect I tried this, but the page does not redirect: None of them seems to work correctly. redirect () work in Visual Studio Debug but fails on the Production IIS server. Is there a clever way to do this? Apr 27, 2024 · Learn to Redirect in Dot. No, the RedirectToAction () method is specifically designed for redirecting within the application. Please check your code and try to register it. Apr 4, 2024 · 0 I found a solution. If you need to redirect to an external URL, you should use the Redirect () method and provide the URL as a parameter. Aug 30, 2023 · For example, when you call the Redirect method in an action method that handles AJAX requests in a controller. RedirectPermanent is not working. But, these features are tied to Controllers or Razor Pages - what if you need to resolve Urls elsewhere, in middleware or even inside of business logic? In this post I describe how you can build a couple of helpers that are more flexible and also provide some Nov 18, 2020 · I'm trying to implement external login/logout for a webpage (asp net core 3. Net Core Reverse Proxy with different root) , it was resolved for me too. Content()`. There are many ways to Aug 24, 2021 · In ASP. net core 6. You can redirect to controller with model data / route data in a Mvc controller. Aug 17, 2020 · Take advantage of redirect action results in ASP. Mar 19, 2021 · My problem: my redirect action method hits the method I am redirected to, but the view stays on the same page it never changes to the redirected one. Net core webapi. location property of java script. Jun 23, 2016 · I'm not a downvoter, but the one caution with this is if you were to call a view with a different name, or if the parameters are important, they are lost. Then the browser will redirect to that action and run that action so that action's method would be run. Sep 21, 2021 · how to redirect external url using javascript in mvcthis code is workajax type 39POST39 url 39UrlAction34getattendenceofliveclass34 34student3439 dataType 39json39 data 39id39 classid success function response alertresponse var url response windowlocationhref Aug 14, 2018 · I'm trying to redirect to external url from an action method but can't get it to work. These techniques enable you to create URLs that can lead to different parts of your application, such as controller actions, static files, or external websites. NET Core MVC project Jun 15, 2023 · What is an Open Redirection Attack? Any web application that redirects to a URL that is specified via the request such as the querystring or form data can potentially be tampered with to redirect users to an external, malicious URL. NET MVC provides us with an easy solution using the RedirectResult class. public class RegisterUserController : Controller { public async Task Jan 20, 2016 · Are you having problems with redirect loops in your MVC app? Maybe you are using ADFS or another identity server/security token service, if so read on. 89@gmail. In this article, I am going to discuss the Redirect Results in ASP in ASP. Instead you would return the redirect Url to the client and have the client redirect by setting window. Each Redirect Result has different way of redirection and execution. Sep 7, 2012 · Trying to put together a quick and dirty page to redirect to another website in a new window. I drop into the if statement the action gets called but once i return the view to the new page, it returns me back to the current page. An ActionResult that returns a Found (302), Moved Permanently (301), Temporary Redirect (307), or Permanent Redirect (308) response with a Location header to the supplied URL. someotherurl. Oct 11, 2017 · When trying to access an authenticated page the user is redirected to the frontend login page, the login page may be using MVC Login Form or Login widget, after successful login the user is not getting redirected to the authenticated page that the user was trying to access initially instead redirected to a specific page. Apr 17, 2025 · A web app that redirects to a URL that's specified via the request such as the querystring or form data can potentially be tampered with to redirect users to an external, malicious URL. com"; return "redirect:" + redirectUrl; However, it appears that i Oct 24, 2016 · In the previous ASP. External party handles the subscription It could be solved using <form/> defining the method=POST and putting all the required parameters in hidden fields. chstml I am creating a partial view. I can get to them by typing the url. Which gives the error- "A potentially dangerous Request. Can anyone guide me to a way to accomplish this? Here's a code snippet from my CreateModel class: public string redURL; Jan 17, 2022 · The Redirect () method and its variations discussed above accept a target URL that can be internal or external to the web application. URL in it. Redirects a request to a new URL by using route parameter values, a route name, or both. Jan 13, 2024 · Hi, How to redirect user to not found when page is not exists without change url in blazor ? Like this link : git not found Mar 27, 2011 · Note that you should not be calling actionContext. 4 - Not Found' when using IIS URL Rewrite? Learn how to resolve this common issue by ensuring the correct modules are installed, Have you ever tried redirecting to an external URL from a controller action in Spring MVC, only to find yourself encountering some issues? Don't worry, we've got your back! In this blog post, we'll address this common problem and provide you with easy solutions to ensure a smooth redirect. Jul 22, 2015 · A guide to redirect and forward in Spring MVC, with a focus on the code and implementation of each strategy. e. net Response. When I try to Post data using httpclient asynchronously, I am getting response as HTML, which is not helping me to redirect to external site. NET Core, so I: created a ASP. Result is not null). How can I do that? Mar 28, 2015 · How do i open an external URL (say google. In this case, return to the initial View and then use JavaScript to redirect to another page. NET Core from one URL to another. google. May 9, 2022 · So I would expect this code to save to the given file and then send the redirect back to the browser. Also, each action result returns a different format of the output. Apr 15, 2024 · Hi @ JA Please check that you have added this URL as the logout URL for your application in Microsoft Entra ID. Aug 2, 2025 · View () vs RedirectToAction () vs Redirect () Methods: An Overview In this article, I am going to discuss View, Redirect, and RedirectToAction in the ASP. hallak. NET Core MVC that instruct the client’s browser to navigate to a new URL. How do I do it? Tried: System. I am running 5. com'); } Like Reply 2 likes jlin1010 OP 5 years ago Level 2 That's a good question. 7. This project demonstrates that how to Redirect users to different pages after the login based on their roles enhances the user experience. Is it possible to redirect to an external URL using RedirectToAction () A. 1) with OpenId Connect (oidc) as the login provder. com'); Route:: get ('/google', 'TestController@google'); public function google() { return redirect ()-> away ('https://www. On the other hand, rewriting happens on the server, and is a translation of one URL to another. 0 and 1. From my Index. Redirect cannot be called in a Page callback May 30, 2024 Jul 23, 2025 · After hitting the URL, the below page will redirect. The page stays on the login screen. " and the url link (google) does work once I remove the added localhost link Jul 26, 2024 · Learn how to effectively manage redirections in Spring Boot web applications for seamless user navigation and improved user experience. Redirect example First, we get the Response object Feb 13, 2020 · Since you're doing a POST via Ajax, it's probably not allowed to do a server-side redirect in that controller method. Sep 26, 2022 · Redirect A web page sometimes changes locations. NET MVC 3. Redirect() For instance, I need to redirect to other pages in a couple of scenarios: WHen the user logs out (Forms signout in Action) I want to redirect to a login page. On the other hand, RedirectToAction () is intended specifically for internal URLs that are based on MVC. Nov 17, 2021 · Thank you for your response, I have to post the data to URL (for ex: testuat/buyonline) and that URL in-turn usually redirects to a page with the prefilled data (which is posted earlier). yahoo. Rewrite). It forms below the URL where clientname is missing in /Account/Login May 21, 2020 · 0 Request. Unlike other redirect attributes, flash attributes are saved in the HTTP session (and, hence, do not appear in the URL). href is often used to redirect users to a different URL or refresh the current page. Mar 29, 2017 · To Use redirect:/ in ModelAndView return type method, you are try following Mar 28, 2022 · The LocalRedirect method is similar to the Redirect method in that it is used to redirect a request in ASP. The url has some attributes and I need to pass it in the same format to the destination website. NET Core MVC, links can be generated in several ways. location to the url. It throws an InvalidOperationException if you use an external URL with it. If I understand correctly, you want to display the swagger doc when using a browser and accessing the application root. Jan 29, 2021 · I am working with an existing MVC 4 website hosted internally that currently uses Federated Identity with a custom login page. In this guide, we'll cover the problem and provide a solution that can get you Sep 5, 2022 · the webapi system can host a swagger endpoint. IIS setting maybe? Examples The following example uses the IsClientConnected property to check whether the client that is requesting the page remains connected to the server. Jul 15, 2021 · HELP! How do you REDIRECT to an external site outside a Razor Component using HttpContext. May 21, 2013 · How to Redirect to external url from controller? Asked 11 years, 11 months ago Modified 1 year, 8 months ago Viewed 10k times Apr 25, 2017 · That's called URL Rewriting and ASP. Turns out UsePathBase works correctly, my Nginx proxy was just configured wrong (as you pointed out). Feb 24, 2023 · Why does asp. cs file in your ASP. 2. The method is part of the Controllerbase class so it’s directly available for use in the controller class. Many developers encounter this issue, especially when they attempt to create hyperlinks pointing to external sites. This can be used to redirect based on some condition. ExecuteResult from within your action filter - MVC will do that automatically after the action filter runs (provided actionContext. Aug 2, 2017 · I am trying to build multiple small ASP. NET MVC returns an HttpResponse of 401 (Unauthorized), the Owin Middleware component detects this and changes it to an Http Redirect (code 302), and the redirection path is to the Open Id provider. NET, it is important to redirect the old address to the new one. I mean, try with this public ActionResult CertifiedEmail () { return View (); } Then you should create a view for your action with the same name ( CertifiedEmail. " and the url link (google) does work once I remove the added localhost link Apr 25, 2017 · When ASP. I tried the 2 statements below separately but both calls append the external url to the current internal page that the user is on: Sep 12, 2024 · In standard web development, window. https://www. In ASP. The reason being is the URL will reflect the action+parameters before the server side redirect. net. It is useful for managing the flow of a web application, especially after form submissions, login operations, or other scenarios where you need to send the user to a different URL, either within the application or to an external Thanks @Craig. By the way, I completely hate this Razor Page Identity in an MVC application and I am fully irritated with this. After logon, the redirect (returnURL) is NOT navigating the user to the requested page. 🎉 Let's modify the code to make it work: By changing the return type of the action method to ActionResult and using the Redirect method, we can now successfully redirect to the external URL. If you want the ~ (aka tilde) to work, you need to make test the virtual path to your application, at which point your host really will be hosted in test and Response. Jul 24, 2024 · By using these methods, you can easily redirect users to different URLs within your ASP. Response. 0 minimal web api, i want to have a api method that redirect to a url instead of display anyThing. NET Core last year though it was slightly more complicated because we changed the entire blog url structure per some "SEO expert" advice the client paid for. The ASP. : Aug 4, 2013 · How can I redirect from a controller to an external URL using POST method and passing some parameters? Basically I need to do automatically what a form would do. However, in the context of LWC and the Salesforce Lightning When the user clicks the button I want them redirected to a data entry view. I have a view that redirects to another view with a simple message after submitting a form. NET Core MVC, URL rewriting can be achieved using the URL Rewriting Middleware. To redirect to an external URL from a controller action in Spring MVC, you can use the RedirectView class and return it from the controller action. if you want to RedirectResult from your controller code, you need to use address at your local domain that will accept the request and won't deny it. NET Core already has special middleware for that (in package Microsoft. Here (in the view with a simple success message) I would like to be able to redirect automatically after 5 Apr 12, 2014 · public ActionResult ExternalLogin(string provider, string returnUrl) { // Request a redirect to the external login provider return new ChallengeResult(provider, Url. Whether you need to redirect users after a successful login, form submission, or any other action, C# provides straightforward ways to handle redirection efficiently. I was stuck with this issue working with . If you have additional questions about this answer, please click Comment. g. In it I want to redirect the user to an external url. When you Mar 8, 2025 · ASP. Thanks! Page Model. If IsClientConnected is false, then the code calls the End method and all page processing is terminated. AspNetCore. See Flash Attributes for more information. I have setup the OpenIdOption on the MVC services that looks like thi Jun 18, 2015 · In addition, you can now redirect those URLs to any controller or action method without requiring any change to the URLs being used by your clients by changing the default values for controller and action. This is because SPAs run routing on the browser, the actual url doesn't exist on the server which is why you need to redirect 404 responses to your SPA page to let blazor's routing kick in. Dec 27, 2016 · The browser will update the URL visible in the address bar, and make a new request using the new URL. This makes links pointing to the old address still work. Sep 28, 2020 · After register the IHttpContextAccessor in the ConfiguraServices method (in the startup. Text)); I then issue a redirect: Re Apr 28, 2024 · When a user tries to access a protected resource without being authenticated, ASP. I add cookies to the Response like so: Response. Add (new HttpCookie ("Username", Username. NET Core MVC Web Application with Real-Time Examples. Nov 10, 2021 · I want to display a hyperlink in browser and when I click on the hyperlink the request goes to my controller and open the URL in new tab of the browser. It is not necessary url that user used in they browser to look at the page (most sites have one or more "proxy" layers between server and user) and it definitely not a url of that will be set on response to be rendered as destination of 30x redirect. A work around could be adding a new action that returns your entire html with no layout. The client uses this info to follow the redirect (which means making a request to the redirect URL). Jan 17, 2022 · The Redirect () method and its variations discussed above accept a target URL that can be internal or external to the web application. For example: View won't change the URL. Or try returning a JavascriptResult from your controller to achieve this. Web. NET Core project f Sep 5, 2022 · Hello everyone in my asp. You can use any of the following methods to return an instance of LocalRedirectResult from your action method. So far i tried this //Controller code RedirectResult in ASP. The url that a user would paste into the address bar before login could be: Apr 3, 2019 · This hodgepodge would not have happened if they didn't introduce Razor Page Identity in the MVC application. When user clicks on a button, a request goes to the server, and depending on the response, I want to either redirect to a different page or stay on current. NET Core provides a mechanism to redirect them to a login page. I was making a POST request from an external js file (with jQuery) and was wondering why the user is not navigated to the new url. This redirection can be absolute or relative URL. When I applied the comment in the link (ASP. And Server. Aug 22, 2017 · public IActionResult Index() { return View(); } But whenever we try to redirect the user to login page it does not append the client name in the URL. I'm having a problem passing cookies in ASP. The URL I am trying to create should look like 45 I am fairly new to MVC but not sure exactly which Redirect replaces the standard redirect used in WebForms is the standard Response. Redirect ("~/whatever") will work. NET Core has built-in May 3, 2012 · If the user is currently not authenticated when trying to access that url, they are redirected to the logon screen. Any idea how can I achieve this? Jan 25, 2019 · I did something similar when migrating a site from ASP. cshtml ), and inside your View paste all your html. [SPR-8636] #13278 Jan 22, 2019 · So when you create a Server-side project, you get server and client projects. config in the directory where the old pages reside Then add code for the old location path and new destination as follows: Jun 1, 2023 · In ASP. Result. Aug 15, 2025 · The method Url. ASP. NET MVC Application with Examples. Controller. NET 8 and MVC w/ Razor views. NET MVC application. HttpContext. An Open Redirect Attack occurs when an application redirects users to an external, potentially malicious URL. It's a small price to pay for actually knowing what's going on. NET MVC to ASP. NET Core applications it is possible to redirect to a specific URL in several different ways. And they are one of my "favorite" features in asp. I will check with my colleague to see if we can/should return redirect ()-> away ('https://www. Jun 3, 2010 · 1 The problem is that your application is not hosted in the directory test, it is instead hosted in the directory above it. NET MVC, there was an option to redirect to the login action, if the user was not authenticated. NET provides Redirect and RedirectPermanent. MapFallbackToPage("/_Host"); with /_Host being the razor page that serves the blazor server web app. NET to a new URL. Redirect Arthur Ochoa 1 Jul 15, 2021, 9:01 AM Aug 20, 2024 · Encountering 'HTTP Error 404. Open the Startup. Suppose we have an application … I want to redirect to a different view depending on the result of a dataset, but I keep getting returned to the page I am currently on, and can't work out why. In this article, I am going to discuss Redirect RedirectToRoute and RedirectToAction in the ASP. Aug 30, 2022 · return RedirectToRoute(routeValue); Use LocalRedirectResult in ASP. This is commonly used after actions like form submissions, logins, or other operations where you want to transition the user to a different page. I got this working finally. Nov 16, 2011 · I want to redirect from one page to another page in ASP. To redirect: Feb 13, 2025 · Redirect results are action results in ASP. NET MVC Application. Login is working fine, but logout redirection isn't working as intend May 27, 2016 · The issue I am running into is when any of my sites do a return Redirect("http://www. NET Core MVC to elegantly redirect a request to a specified URL ASP. cs file), your code works well, it will redirect to the external url. NET Core MVC This action result is used when you want to redirect to a local URL. I have an action I call from an anchor thusly, Site/Controller/Action/ID where ID is an int. This tampering is called an open redirection attack. net Core MVC in 10 Mins (With Examples) Redirect is one the most important parts whenever you are developing an application. NET Core MVC is essential for navigating between different parts of your web application. NET, whatever the authentication mechanism being used (FormsAuth, CookieAuthentication Middleware, ADFS or any other identity provider) the 401 http status code is always the starting point of the authentication process. Path value was detected from the client (:). Redirect ToPage Method In this article Definition Overloads RedirectToPage () RedirectToPage (Object) Show 6 more Definition Jul 6, 2024 · How can I add headers to a request and redirect to an external URL in a controller action? I've tried HttpClient, WebClient and HttpWebRequest but none support redirecting. The browser gets the redirect response and then sends another GET request to the server for the given URL. NET MVC, the base URL is always rewritten to the URL of my site - this is true even if the URL is completely external to my URL. Issue: When user clicks on a button in the above page, the MVC Controller method that handles this click should do some processing and redirect the user to an external domain say google. NET Core has support for resolving Urls in Controllers and Razor Pages via embedded `~/` links in Views and via `Url. com I already tried using the NavigationManager, as I used it when redirecting between my sites but it didn't work. Sep 22, 2023 · Learn how to redirect users to a specific webpage after signing out from Entra ID. May 30, 2024 · Developer documentation for all DevExpress products. I looked for steps explaining how to wire up the onclick event of the button but I'm new to MVC and kinda lost at this point. Aug 7, 2018 · If you use jquery it will work, yes, because you make a request from client-to-client using the window. Apr 17, 2015 · What I need to do is set up routes for my functional views/controller-actions and redirect the remaining urls to the external site regardless of whether or not the specified url has a matching controller/action. NET Core Razor Pages with step-by-step instructions and configurations. Friendly URL's simple allow you to take a "messy" and rather unfriendly URL, and present the "url" parameter's in a nice clean, easy to read URL. Jan 25, 2016 · User visits our website For any subscription process, user click the relevant section that should redirect the view to specified external URL having POST parameters. : Jun 1, 2023 · In ASP. On button click event I have written JavaScript code like below. Url is url of the current request as server itself sees it. NET Core MVC: Install the Microsoft. Trailing slashes on Nginx locations and proxy_pass will not work. As a coder, we need to use different action results to get the expected output. Redirect ToRoute Method In this article Definition Overloads RedirectToRoute (Object) RedirectToRoute (String) Show 3 more Definition Oct 25, 2015 · A redirect is client side, so what you pass after the redirect: should lead to a valid URL not a view name And stop mixing versions you are mixing Spring Boot 1. Response. NET MVC, I'm trying to create a link that includes an anchor tag (that is, directing the user to a page, and a specific section of the page).