(path) execute the ASP script specified by path. If path is an absolute path,
it should be for an ASP page within the same application space (the same folder
or one of its subfolder) path may contain query string date.
for a moment that you want some information at the top and bottom of every page
on your site. This might be some graphics, links, contact information, and so
on. One way you could do this is to include some file at the top of every page
and another one at the bottom. This will work, but it lacks some flexibility.
You might decide that you want two different ways to view each page. If you want
to keep your options open for expansion, you might decide to use server. Execute.
Control to another Page
is used to transfer control to another ASP page. When it is called, all the data
related to the calling page is transferred to the new page. This means that if
variables of session or application scope has been given values, those values
are kept in the new page. State information and values for the built-in objects
are transferred, too. Also the contents of the request collections are kept and
are available to the new page.
can even perform a server.Transfer between two pages in separate applications.
In this case, the value of the application variables and objects will be the same
as if the second page were in the same application as the first. That is, the
values of application scope variables and objects are kept after the transfer.
How to Use Server.Execute
<% Option Explicit %>
Response.Write( I am in page 1 <BR>)
Response.Write(Back in page 1)
< / BODY>
This page is almost identical to page1.asp. the only difference is that line
7 uses a server. Transfer in place of the server.Execute. You can see the result
of this listing. Notice that in this version, the third line is not printed. That
is because you never return to the calling page when you do a server.Transfer.
In this regard, server.Transfer may be used a bit like the Response. Redirect.
tells the users browser to make a new request. This result in the creation
of a new object context, which is used to contain the session and request objects
as well as some server variables. Sometime when you want to send the user to different
page, you will want a new object context to be created. In such case, you should
If you do not need a new object context, you are
probably better off using server.Transfer, which is faster because it dose not
involve as many communications or the creation of a new object context.
to our mailing list and receive new articles
through email. Keep yourself updated with latest
developments in the industry.
: We never rent, trade, or sell my email lists to
We assure that your privacy is respected
.NET Programming Tutorial Homepage