6

我希望这个问题是自我描述的。

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

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

我在考虑 asp.net 移动控件,但项目页面似乎是一个死/未更新的框架,并且不确定是否仅支持 windows 手机或什么!

编辑 谢谢你的问题,但他们都只从一个方面解决了我的问题.. 我的意思是这将如何让我使用 BlackBerry 应用程序选项,例如让我的网站在设备后台运行或向我的用户发送通知!

4

4 回答 4

4

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

您还可以尝试阅读有关移动设计的书籍,例如 Cameron Moll 的“Mobile Web Design”。

于 2011-02-23T20:47:33.677 回答
3

如果您使用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

于 2011-02-23T20:52:07.777 回答
2

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

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

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

于 2011-02-23T20:49:13.997 回答
0

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

于 2011-02-23T20:48:17.647 回答