Search code examples
asp.netperformanceserver-sideclient-side

Moving from Page A to Page B in Asp.Net. What is the "Best" way?


I have a user on what we will call PageA.aspx. This user needs to get to PageB.aspx. The obvious way is have a hyperlink that simply sends them to PageB.aspx. That got me thinking about the other ways to get between pages. One could use javascript to do a client side jump. There is also the seemingly bulky server side redirection.

What, if any, are the performance hits between these different methods?

I am going to assume the server side is a bit more heavy weight but by how much?

Do these methods scale differently?

Are there any hidden issues with doing it one way versus another?


Solution

  • A real link is best for most circumstances. All user agents know what a link is and what it represents. It's best for SEO, accessibility and usability.

    A server-side (via postback) redirect is good if you need to, say, need to track specifics about which link was clicked... But it's an additional request to the server (and time to the user). It also botches SEO (et al) so it's only a viable option inside a proper "web app" where spidering or accessibility are controlled or disregarded.

    JS can give you the power of tracking but it's useless (on its own) in environments where JS is disabled. Sending activity back to the server adds load so that's something to consider.

    If you need it, consider using standard links and using jquery to hook the click events to track things. But really... Only if you need it as it will slow the user experience slightly.

    In short: unless you've good reason not to, stick with the standards.