473,846 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Load Page. VB vs Javascript. Need opinion. Thank You.

Hello,

I am working on an ASP.NET/VB web site.
I have several links including menu links.

Considerer a want to load a page named page.aspx.

I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArg s, pageURL as
String)
Response.Redire ct(pageURL)
End Sub

What are the advantages or disadvantages of each method?

Which one should I use?

Thanks,
Miguel

Nov 19 '05 #1
3 2127
"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in news:
#J************* *@TK2MSFTNGP12. phx.gbl:
I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArg s, pageURL as
String)
Response.Redire ct(pageURL)
End Sub

What are the advantages or disadvantages of each method?


Javascript can be disabled.

Server side will require a round trip. But a server side transfer will
allow you to log what happened (or do additional processing).

Personally I'll choose a sever side transfer.

--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Think of these software entities as tools. In that context, think of one as
a Framing hammer, and one as a Finishing hammer. Now, in that context, how
would you answer the following question:
What are the advantages or disadvantages of each method?
Answer: There are no "advantages " or "disadvanta ges" to either. There are
properties and characteristics . Neither good nor bad, unless used in some
context. For example, a Framing hammer is perfect for framing. A Finishing
hammer is perfect for finishing. But a Framing hammer will make a mess if
you use it for finishing, and a finishing hammer will take forever to build
a frame.

Again, using the hammer analogy, how would you answer the following:
Which one should I use?
Answer: Use the tool that has the characteristics and properties that are
appropriate for the given situation. If you're building the frame of a
house, use a framing hammer. If youre putting in moulding, use a finishing
hammer.

So much for the philosophy. Now let me answer your specific questions, posed
in a more appropriate fashion:

What are the characteristics and properties of each method?

Actually, you have more options than the ones you mentioned, such as:

Client-side:
JavaScript
Hyperlink
Server-side:
Response.Redire ct
Server.Transfer

And a few others that are much less common, and used for special purposes.

On the client side, a hyperlink is the simplest method to load a different
document into the browser, and if you're strictly talking about links in a
menu, I would go with that. Remember that the links can also include
QueryStrings to pass data to the new page. You can use JavaScript if you
need additional client-side processing, need to open the page in a new
window (which you can also do with a hyperlink, but with less control over
the window), or for somewhat more complex situations.

On the server side, Response.Redire ct is often useful, as it causes the
browser to make a second request for the new document. The Redirect
directive is added to the HTTP headers in the Response, causing the browser
to load the new document. With Response.Redire ct, you can use a QueryString
to send data to the new page. Note that with Response.Redire ct, you are
sending a GET request for the new page. Server.Transfer can be useful in
situations where you need to transfer server-side resources and memory from
one page instance to the other. Note that Server.Transfer does NOT tell the
browser to request a different page, but transfers server-side processing to
the new page, and the browser "thinks" it is still looking at the same page
(URL).

When should I use one or the other?

Again, a hyperlink is the simplest and fastest way of transferring to a new
page. with the addition of a QueryString to the hyperlink, you can also send
data to the new page. JavaScript is also fast, but a little more complex,
and is useful in situations where you need to do additional CLIENT-side
processing, or have control over a new window, such as resizing it, or
setting up the status bar, and other browser elements in the new window.

Response.Redire ct can be the simplest way of transferring to a new page, if,
for example, you have some server-side condition that changes and requires a
redirect to a new page. Rather than returning the same page to the client,
and requiring additional client-side processing to transfer, you can do the
Redirect which causes the browser to request the new page, without looking
as if it had received the first page in the first place. However, it should
be noted that Response.Redire ct actually causes the browser to make TWO
Requests, one for the first page, and one for the redirected page, and
involves some network latency. Server.Transfer has the advantage of not
requiring a second Request from the browser, but remember that it returns a
new page with the same URL as the original page. Server.Transfer can be
useful when you want to do a partial Response from one page, and finish it
from another.

If you keep these characteristics of each method in mind, it should become
apparent at what time(s) to use which method(s).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Hello,

I am working on an ASP.NET/VB web site.
I have several links including menu links.

Considerer a want to load a page named page.aspx.

I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArg s, pageURL as String)
Response.Redire ct(pageURL)
End Sub

What are the advantages or disadvantages of each method?

Which one should I use?

Thanks,
Miguel

Nov 19 '05 #3
Thanks Kevin for your description of the most common options I have.
I will be useful in the future.

Cheers,
Miguel

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:ke***@DIES PAMMERSDIEtakem pis.com:
Think of these software entities as tools. In that context, think of one as
a Framing hammer, and one as a Finishing hammer. Now, in that context, how
would you answer the following question:

What are the advantages or disadvantages of each method?

Answer: There are no "advantages " or "disadvanta ges" to either. There are
properties and characteristics . Neither good nor bad, unless used in some
context. For example, a Framing hammer is perfect for framing. A Finishing
hammer is perfect for finishing. But a Framing hammer will make a mess if
you use it for finishing, and a finishing hammer will take forever to build
a frame.

Again, using the hammer analogy, how would you answer the following:

Which one should I use?

Answer: Use the tool that has the characteristics and properties that are
appropriate for the given situation. If you're building the frame of a
house, use a framing hammer. If youre putting in moulding, use a finishing
hammer.

So much for the philosophy. Now let me answer your specific questions, posed
in a more appropriate fashion:

What are the characteristics and properties of each method?

Actually, you have more options than the ones you mentioned, such as:

Client-side:
JavaScript
Hyperlink
Server-side:
Response.Redire ct
Server.Transfer

And a few others that are much less common, and used for special purposes.

On the client side, a hyperlink is the simplest method to load a different
document into the browser, and if you're strictly talking about links in a
menu, I would go with that. Remember that the links can also include
QueryStrings to pass data to the new page. You can use JavaScript if you
need additional client-side processing, need to open the page in a new
window (which you can also do with a hyperlink, but with less control over
the window), or for somewhat more complex situations.

On the server side, Response.Redire ct is often useful, as it causes the
browser to make a second request for the new document. The Redirect
directive is added to the HTTP headers in the Response, causing the browser
to load the new document. With Response.Redire ct, you can use a QueryString
to send data to the new page. Note that with Response.Redire ct, you are
sending a GET request for the new page. Server.Transfer can be useful in
situations where you need to transfer server-side resources and memory from
one page instance to the other. Note that Server.Transfer does NOT tell the
browser to request a different page, but transfers server-side processing to
the new page, and the browser "thinks" it is still looking at the same page
(URL).

When should I use one or the other?

Again, a hyperlink is the simplest and fastest way of transferring to a new
page. with the addition of a QueryString to the hyperlink, you can also send
data to the new page. JavaScript is also fast, but a little more complex,
and is useful in situations where you need to do additional CLIENT-side
processing, or have control over a new window, such as resizing it, or
setting up the status bar, and other browser elements in the new window.

Response.Redire ct can be the simplest way of transferring to a new page, if,
for example, you have some server-side condition that changes and requires a
redirect to a new page. Rather than returning the same page to the client,
and requiring additional client-side processing to transfer, you can do the
Redirect which causes the browser to request the new page, without looking
as if it had received the first page in the first place. However, it should
be noted that Response.Redire ct actually causes the browser to make TWO
Requests, one for the first page, and one for the redirected page, and
involves some network latency. Server.Transfer has the advantage of not
requiring a second Request from the browser, but remember that it returns a
new page with the same URL as the original page. Server.Transfer can be
useful when you want to do a partial Response from one page, and finish it
from another.

If you keep these characteristics of each method in mind, it should become
apparent at what time(s) to use which method(s).

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.
"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hello,

I am working on an ASP.NET/VB web site.
I have several links including menu links.

Considerer a want to load a page named page.aspx.

I can do it using javascript. Or using this code:
Sub loadPage(sender As Object, e As System.EventArg s, pageURL as String)
Response.Redire ct(pageURL)
End Sub

What are the advantages or disadvantages of each method?

Which one should I use?

Thanks,
Miguel


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3017
by: sean | last post by:
var strPath = "c:\myXml.xml"; var objDom = new ActiveXObject("Msxml2.DOMDocument"); alert('step 1'); objDom.load(strPath); alert('step 2'); ................ AFTER step 1 I'm getting an errorrrrrrrrrrrr. Im just going crazy. Error: Access denied!
25
19987
by: chris | last post by:
how would i resize a browser window to a specific size as the page loads, using html or javascript
6
2371
by: sylcheung | last post by:
Hi, How can I be notified when the document load is complet in JavaScript? I am referring to the whold document load is complete, mean all images/external files/frame/iframes have been loaded. I think there is a window.addEventListener() function but I am not sure which event to listen to. Thank you.
4
16428
by: ReGenesis0 | last post by:
Okay, this involves integrating javascript with PHP (though you don't have to know PHP to understand my question.) I have a page. It has a link. When someoen clicks on the link, iw ant to know. But- it's an OFFSITE link. Fundamentally untrackable. This is my comprimise... when you click on that link, Javascript executes a function in half-second before the page unloads. That fuction loads an external image. (purely into memory...
2
1805
by: A.Wussow | last post by:
Hi Everybody, i want to load dynamically content from some user controls (with forms, or some data-controls) using atlas. So i use an UpdatePanel for loading the user control into a placeholder. Using buttons for loading new content works fine. But i still want to use a function which is callable per javascript. I think this way is more flexable than using the Buttons, becaus every button needs it's own Sub-Routine. But i want to have...
3
2734
by: The alMIGHTY N | last post by:
I have an XSL file that works with a typically large XML data set generated dynamically from a database. This data is written to the HTML result as a deep multi-dimensional array that is used by Javascript functions to build large expanding/collapsing tables to display the data. The original developer wrote the page so that many writeln functions were called in embedded Javascript to actually write the table as the page was loading....
8
8748
by: sneddo | last post by:
Ok I am trying to do the above, I have got a script that will restrict the length but it requires the user to enter the field and hit a key, before it will work. This would normaly be find, but the title field gets its information from a previouse page so its value can easily be over 40 chars. (I can not restrict the length on the previouse page.) The major dificulty is that there is no form on the aspx page, and I do not have access to...
9
3659
by: Denis | last post by:
Hello, Maybe somebody already solved this task. I need to load JS asynchronously without blocking browser. This means that I do not need to block browser to load/render during loading script. The simple construction to do this: jsJSNode = document.createElement(“script”); jsJSNode.type = “text/javascript”; jsJSNode.src = “http:// den-01/Default.aspx“; document.body.appendChild(jsMyNode);
5
3438
by: =?Utf-8?B?TWF0Y29u?= | last post by:
Hello, I have a asp.net 2.0 (vb.net) page, which uses a master page, and there is a javascript function (myfunction) defined in the <headof that master page. Is there a way to run the function from the page load event of the page? I am able to run the function when there is a change in, say, a text box, by adding the following to the page load event: TextBox.Attributes.Add("onChange", "javascript:myfunction()")
0
9879
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10976
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10640
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10705
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5714
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4111
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.