Kas*_*hef 6 c# webforms blackberry smartphone
我希望这个问题能够自我描述.
我目前正在开发一个在数据层中使用MS SqlServer数据库的asp.net网站.
而且我在想我有什么选择来获得移动版本(最重要的是支持BlackBerry和iPhone以及希望每个移动设备!),当在黑莓上使用时,我希望能够让它在BB的背景下运行.
我在考虑asp.net移动控件,但项目页面看起来像一个死/未更新的框架,并不确定是否只支持Windows手机或什么!
编辑 感谢您的问题,但他们都只是从一个相关的问题解决了我的问题.我的意思是如何让我使用BlackBerry Appliction选项,例如让我的网站在设备后台运行或向我的用户发送通知!
如果您使用ASP.Net MVC创建应用程序并创建常规视图和移动视图。您也可以使用jQuery Mobile来帮助处理移动视图。
这个问题涵盖了如何根据设备类型更改视图,
如果您使用 WebForms,您可以根据浏览器更改 MasterPage,从而使您能够更轻松地切换到移动版本:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.Browser.IsMobileDevice)
MasterPageFile = "~/Mobile.Master";
}
Run Code Online (Sandbox Code Playgroud)
或者使用 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);
}
}
}
Run Code Online (Sandbox Code Playgroud)
无论哪种方式,请阅读本文: http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application