ASPX isn't generating WML output

J

Jaime Stuardo

Hi all..

I have developed an ASP.NET Mobile Web project using Visual Studio .NET
2003. The page is very simple (just displays a message).

I placed the page in a web server running Windows Server 2003.

When I connect to the page using Internet Explorer, it receives the correct
HTML page, but when I connect to it using my Cell Phone, I get the "Bad
Gateway" error. I think it is because IIS is sending HTML instead of WML.

I have used a cell phone emulator and I get this error:

"Wrong mime-type, I got text/html; charset=utf-8, but I want
text/vnd.wap.wml.
This error occurs when you request a page that is not a WAP page, or when
the webserver isn't set up correctly for hosting WAP sites "

That confirms me that IIS is sending HTML.

How can I solve it?

Thanks
Jaime
 
J

Jaime Stuardo

Hello Guyv..
I have done so, but I realized that Page_Init isn't being called.
This is the code I have:

public class download : System.Web.UI.MobileControls.MobilePage
{
protected System.Web.UI.MobileControls.Form frm;

private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("hello");
}

void Page_Init()
{
Response.ContentType = "text/vnd.wap.wml";
}
.....
}

I have placed breakpoints in Page_Load and in Page_Init and only Page_Load
get called.

Jaime
 
J

Jaime Stuardo

Hi again..

I'm wondering why I should put Response.ContentType = "text/vnd.wap.wml";
since ASP.NET could generate the corresponding output depending on the
target device.

I have followed the tutorial in http://www.w3schools.com and there it was
created a simple WAP application that is supposed to be viewed as a WML card
in a cellphone and as HTML in a pocket PC.

Jaime
 
N

news.microsoft.com

Hi Jaime,

I'm sorry. I didn't test WML pages access on Cellular phone with MS
MobileControl.
If MobilControl is "automatically" change the content type
text/html(default) to text/vnd.wam.wml,
Nothing to problem. But most phones WAP browser can't accept text/html
content.

And this is one of important thing.
The WML contents are must without caching. and well-formed document type.

Response.AddHeader ("Cache-Control", "no-cache");
Response.AddHeader ("Expires", "0");
Response.AddHeader ("Pragma", "no-cache");


this code is tested on WML 1.1 browser embedded celluar phone.


<%@ Page Language="C#" Runat="server" Debug=True %>

<script language="C#" runat="server">

void Page_Init()
{

..

Response.ContentType = ("text/vnd.wap.wml");
Response.AddHeader ("Cache-Control", "no-cache");
Response.AddHeader ("Expires", "0");
Response.AddHeader ("Pragma", "no-cache");

..

}

</script>

.......


<?xml version="1.0" encoding="UTF-8"?>
<wml>

<card id="init">

<p align="center">
test
</p>
</card>

</wml>




PS. your code is incurrect.

public class download : System.Web.UI.MobileControls.MobilePage
{
protected System.Web.UI.MobileControls.Form frm;

private void Page_Load(object sender, System.EventArgs e)
{
/// Response.Write("hello");

Response.Write ("<wml><card id=\"init\"><p>Hello</p></card></wml>")
}

void Page_Init()
{
Response.ContentType = "text/vnd.wap.wml";
}
.....
}



Good luck

GuyV (guyv(at)guyv.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top