6

I hope the question is self-describing.

I'm currently developing an asp.net website which uses a MS SqlServer database in the data layer.

And I was thinking what are my options to get a mobile version (most importantly supports BlackBerry and iPhone and hopefully every mobile device!) and when used on blackberry I want to be able to let it run at the BB's background.

I was thinking about asp.net mobile controls but the projects page seems like a dead/not-updated framework and not sure exactly if supports only windows mobiles or what!

Edit Thank you for your questions, but they all covered my problem from only one respective .. I mean how this is going to let me use the BlackBerry Appliction options like letting my website run at the device background or sending notifications to my users!

Mazen Elkashef
  • 3,430
  • 6
  • 44
  • 72

4 Answers4

4

This is mostly going to be a product of styling. Mobile websites work just like regular websites these days, except you want to use CSS and images that work well on a mobile device. You can use a product like 51 Degrees that will give you a bunch of information on what type of device is connected, so you can customize your output based on resolution or any number of other things if you so desire.

You could also try a book on mobile design, such as "Mobile Web Design" by Cameron Moll.

Daniel Ahrnsbrak
  • 1,067
  • 8
  • 15
  • +1 dahrnsbrak I like your answer but do you have any advice about my problem from another respective ? *Please check my edit* – Mazen Elkashef Feb 23 '11 at 21:04
  • this doesn't sound like a website, it sounds like you want to create a blackberry application. i've never heard of running a website as the background image (if that's what you mean) of the blackberry, and there's no way to pass messages from the blackberry browser to the OS in reliable way. – Daniel Ahrnsbrak Feb 23 '11 at 22:14
  • It's not I mean, by running the web application in the BB's background I mean running it in the background of the OS itself .. like when you hide any application on the windows in the system tray or in the system's background .. and websites send some sort of notifications to the BB device but I'm not sure how! anyway I think I might need a dedicated BB application to get what this device offers and another one for the other mobile types. – Mazen Elkashef Feb 24 '11 at 03:29
3

If you use ASP.Net MVC to create your app and create regular and mobile views. You can use jQuery Mobile to help with the mobile views too.

This question covers how to change your view based on the device type,

If you use WebForms, you can change your MasterPage depending on the browser thus giving you the ability to swap to mobile versions more easily:

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

Or use a Global.asax to redirect mobile requests completely:

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);
        }
    }
}

Either way read this article: http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application

Community
  • 1
  • 1
brendan
  • 29,308
  • 20
  • 68
  • 109
  • Thanks for letting me know that it's possible with MVC but how about WebForms ? – Mazen Elkashef Feb 23 '11 at 20:59
  • Multi master pages and redirecting are two convenient methods but does this mean that I have to create a dedicated master page for every device resolution and detect the device model or it's browser and redirect them !?? – Mazen Elkashef Feb 24 '11 at 03:32
  • Ideally you're only developing to 1 maybe 2 different mobile resolutions. If you're doing more than that you probably want to consider building native apps. – brendan Feb 24 '11 at 04:10
2

You don't really need to do anything special; Just create an alternative stylesheet that is optimized for 320px width viewport. You can serve this stylesheet through a separate stylesheet using the "media" attribute of the LINK element, or you can use CSS Media Queries within your mater stylesheet. Some relevant info:

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

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

Tim Hettler
  • 1,246
  • 9
  • 12
0

If you are using asp.net MVC be sure to check out Web Application Toolkit for Mobile Web Applications

Bala R
  • 107,317
  • 23
  • 199
  • 210