Which the best method to use in navigating through web application pages

Donald Symmons 2,856 Reputation points
2023-11-01T07:57:08.9566667+00:00

Hello Forum,

Please I will like to know if there is any special advantage in any of these page navigation links?

For the .aspx pages I have these:

  1. https://myaddress.com/dashboard
  2. /dashboard
  3. dashboard

In the serverside window:

  1. Response.Redirect("https://myaddress.com/dashboard");
  2. Response.Redirect("/dashboard");
  3. Response.Redirect("dashboard");

Please is there any that is best preferred, because I have seen different people use different redirect codes to navigate web pages.

I asked this because I will like to know if there is any security advantage to using a particular redirect code.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,461 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,318 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,390 questions
0 comments No comments
{count} votes

Accepted answer
  1. QiYou-MSFT 4,306 Reputation points Microsoft Vendor
    2023-11-01T09:40:14.2766667+00:00

    Hi @Donald Symmons

    Absolute URL: https://myaddress.com/dashboard

    Relative URL: /dashboard, dashboard

    Some browsers may reject the relative URL.

    For mobile pages only, if your application relies on cookieless sessions, or might receive requests from mobile devices that require cookieless sessions, using a tilde (~) in a path can result in creating a new session and potentially losing session data. To set a property on a mobile control with a path such as "~/path", resolve the path using ResolveUrl "~/path" before assigning it to the property.

    Generally speaking, Absolute URL is more stable. It is not affected by other factors.

    When you change the name of a folder or project or other actions to change the file path, Relative URL will be affected.

    Best regards,
    Qi You


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful