1

Using ASP.NET MVC2, how would I go about creating a WML view for a given controller action? (Or any other non-aspx view for that matter).

E.g. http://localhost/Store/Browse would actually return a text/vnd.wap.wml response.

<?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="main" title="First Card">
    <p mode="wrap">This is a sample WML page.</p>
  </card>
</wml>

There are other examples where this would be useful, e.g. returning a xml packet etc.

Thanks!

nordisk
  • 113
  • 6

2 Answers2

0

Check out this article from Scott Hanselman.

http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx

Shows how to dynamically return Iphone, Windows mobile (WML) views from a single controller method.

HTH

RPM1984
  • 72,246
  • 58
  • 225
  • 350
  • Thanks, I've read this article and I am using parts of it already to select different views based on the browser capabilities but I couldn't see anything on non-aspx views. – nordisk Sep 16 '10 at 05:00
  • Ok - i misunderstood. Sounds like you are looking for the WATM: http://code.msdn.microsoft.com/WebAppToolkitMobile. I could be wrong though - i have never actually tried this, its from pure reading/hear-say – RPM1984 Sep 16 '10 at 05:04
0

Any of these:

  1. try using an aspx view - just instead of using html tags use wml
  2. return a string or ContentResult with what you want to send directly.
  3. define your own ViewEngine + Views / base it on an existing viewengine.
eglasius
  • 35,831
  • 5
  • 65
  • 110
  • Option 1 appears to work well provided I also set the Response ContentType to text/vnd.wap.wml. Thanks! – nordisk Sep 16 '10 at 21:19