Create non aspx views (e.g. WML) with ASP.NET MVC2
-
03-10-2019 - |
문제
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!
해결책
Any of these:
- try using an aspx view - just instead of using html tags use wml
- return a string or ContentResult with what you want to send directly.
- define your own ViewEngine + Views / base it on an existing viewengine.
다른 팁
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
제휴하지 않습니다 StackOverflow