繁体   English   中英

什么是asp.net开发人员开发其现有网站的移动版本的最佳(简单和高效)解决方案

[英]What's the best (easy&efficient) solution for asp.net developers to develop a mobile version of their existing website

我希望这个问题能够自我描述。

我目前正在开发一个在数据层中使用MS SqlServer数据库的asp.net网站。

而且我在想我有什么选择来获得移动版本(最重要的是支持BlackBerry和iPhone以及希望每个移动设备!),当在黑莓上使用时,我希望能够让它在BB的背景下运行。

我在考虑asp.net移动控件,但项目页面看起来像一个死/未更新的框架,并不确定是否只支持Windows手机或什么!

编辑 感谢您的问题,但他们都只是从一个相关的问题解决了我的问题。我的意思是如何让我使用BlackBerry Appliction选项,例如让我的网站在设备后台运行或向我的用户发送通知!

这主要是造型的产物。 移动网站最近像普通网站一样工作,除了你想使用CSS和在移动设备上运行良好的图像。 您可以使用51度等产品,它可以为您提供有关所连接设备类型的大量信息,因此您可以根据分辨率或任何其他数量的其他内容自定义输出。

您还可以尝试一本关于移动设计的书,例如Cameron Moll的“移动网页设计”。

如果您使用ASP.Net MVC来创建您的应用程序并创建常规和移动视图。 您也可以使用jQuery Mobile来帮助处理移动视图。

此问题涵盖了如何根据设备类型更改视图,

如果您使用WebForms,则可以根据浏览器更改MasterPage,从而使您能够更轻松地切换到移动版本:

protected void Page_PreInit(object sender, EventArgs e)
{
    if (Request.Browser.IsMobileDevice)
        MasterPageFile = "~/Mobile.Master";
}

或者使用Global.asax完全重定向移动请求:

void Session_Start(object sender, EventArgs e)
{
    // Redirect mobile users to the mobile home page
    HttpRequest httpRequest = HttpContext.Current.Request;
    if (httpRequest.Browser.IsMobileDevice)
    {
        string path = httpRequest.Url.PathAndQuery;
        bool isOnMobilePage = path.StartsWith("/Mobile/", 
                               StringComparison.OrdinalIgnoreCase);
        if (!isOnMobilePage)
        {
            string redirectTo = "~/Mobile/";

            // Could also add special logic to redirect from certain 
            // recognized pages to the mobile equivalents of those 
            // pages (where they exist). For example,
            // if (HttpContext.Current.Handler is UserRegistration)
            //     redirectTo = "~/Mobile/Register.aspx";

            HttpContext.Current.Response.Redirect(redirectTo);
        }
    }
}

无论哪种方式阅读本文: http//www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application

你真的不需要做任何特别的事情; 只需创建一个针对320px宽度视口进行优化的替代样式表。 您可以使用LINK元素的“media”属性通过单独的样式表提供此样式表,也可以在mater样式表中使用CSS Media Queries。 一些相关信息:

http://googlewebmastercentral.blogspot.com/2011/02/making-websites-mobile-friendly.html

http://www.css3.info/preview/media-queries/

如果您使用的是asp.net MVC,请务必查看Web Application Toolkit for Mobile Web Applications

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM