I can't redirect to another website in ASP.NET Core MVC. I want to have a link that redirect to another website but it's not working for me.
I tried to put the link (e.g. https://www.twitter.com/
) simply in the href="..."
of my <a>
tag like this:
<a href="https://www.instagram.com/mclaren/" target="_blank">Twitter</a>
Is there any reason why it doesn't work? I have to display every socials (that are in my database in the table Contact) of every contact, so I need this to work and to work efficiently.
Thank you!
You can try different approach :- Create a Action method in you controller
public IActionResult RedirectExample()
{
return Redirect("https://www.instagram.com/mclaren/");
}
and in razor page
<a href="/Home/RedirectExample" target="_blank">Instagram</a>