In the second part of this paper, I shall discuss some of the
issues involving in developing dynamic WAP applications:
Ø Redirecting pages
Ø Caching on WAP devices
Ø Cookie support on WAP
devices, and maintaining state using the ASP Session object
Ø Maintaining state without
cookie support
Ø Detecting WAP devices
Ø Passing values from ASP
server-side variables to WML client-side variables, and vice
versa.
Ø Tips for using ASP to
generate WML content
Ø Common errors
Redirecting Pages
In web application development, it's not unusual to see a
browser being redirected to another web page. This may happen, for
example, because you don't have the permissions required to view a
page, and you must therefore log in before you can do so.
In ASP, you can use the Response.Redirect() method to perform
page redirection. Let's take a look at an example.
Deck1.asp
<% Response.ContentType = "text/vnd.wap.wml" %>
<% Response.Buffer = True %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1deck1" title="Deck1">
<p>
This is card 1,
but you won't see it...
<%
Response.Redirect "deck2.asp" %>
</p>
</card>
</wml>
Deck2.asp
<% Response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1deck2" title="Deck2">
<p>
This is
deck2.
</p>
</card>
</wml>
When deck1 is viewed using the UP.Simulator, the WAP browser
will be redirected to deck2.

Note that for redirection to occur, you must buffer the page
created by the ASP parser using the Response.Buffer property:
<% Response.Buffer = True %>
Buffering is disabled by default in ASP 2.0 but enabled by
default in ASP 3.0.
If a page is not buffered, the web server will send the HTTP
headers to the client before the ASP parser has finished parsing
the ASP document. In the case of page redirection, this will cause
an error. Try setting the Response.Buffer property to False, and
you'll see the error message:

The error message is:
The HTTP headers are already written to the client browser. Any
HTTP header modifications must be made before writing page
content.