.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
If you don't want to do anything a link is enough (and saves an extra redirection). It's also a bit unclear if you want this link to point to your site root or to a 3rd party site.
The <a> tag is written in the aspx page and displayed in the browser. If the user clicks the link the browser goes to the href URL.
If you need to do redirect the browser from the code behind then use a Response.Redirect..
Since this is such a basic concept, I assume there is a problem you are trying to solve. Can you explain what you are trying to do or why you wonder if there is a better way?
Member
47 Points
1656 Posts
Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 16, 2020 04:52 PM|aspfun|LINK
In a button, using reponse.redirect("www.mycomany.com") to open company home page is the good way?
If not, please let me know the another way.
All-Star
53041 Points
23612 Posts
Re: Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 16, 2020 04:55 PM|mgebhard|LINK
Or a standard link...
All-Star
20953 Points
4984 Posts
Re: Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 16, 2020 05:29 PM|asteranup|LINK
Hi,
If you need to do this with backend code then you can simply use-
This will redirect to the root of the website, ideally its homepage.
Anup Das Gupta
Visit My Blog
You can also connect with me in LinkedIn
Contributor
2090 Points
668 Posts
Re: Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 17, 2020 02:26 AM|XuDong Peng|LINK
Hi aspfun,
This code you used:
Equivalent to:
reponse.redirect("www.mycomany.com",true);
It will call HttpResponse.End Method upon completion and throw a ThreadAbortException exception, which has an adverse effect on the performance of the web application.
Therefore, I recommend that instead of this overload you use the HttpResponse.Redirect(String, Boolean) overload and pass false for the endResponse parameter, and then call the CompleteRequest method.
For more details, you could refer to below link:
https://docs.microsoft.com/en-us/dotnet/api/system.web.httpresponse.redirect?view=netframework-4.8
Best regards,
Xudong Peng
Member
47 Points
1656 Posts
Re: Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 17, 2020 10:21 AM|aspfun|LINK
Hi mgebhard,
Is it possible of using code behind form to do it?
All-Star
48510 Points
18072 Posts
Re: Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 17, 2020 10:52 AM|PatriceSc|LINK
Hi,
If you don't want to do anything a link is enough (and saves an extra redirection). It's also a bit unclear if you want this link to point to your site root or to a 3rd party site.
Do you have some problem in doing what you want?
All-Star
53041 Points
23612 Posts
Re: Using reponse.redirect("www.mycomany.com") to open company home page is the good way?
Jul 17, 2020 11:31 AM|mgebhard|LINK
The <a> tag is written in the aspx page and displayed in the browser. If the user clicks the link the browser goes to the href URL.
If you need to do redirect the browser from the code behind then use a Response.Redirect..
Since this is such a basic concept, I assume there is a problem you are trying to solve. Can you explain what you are trying to do or why you wonder if there is a better way?