Developing ASP.NET Web Applications for Windows Phone 7

Let me start this blog post with Congratulating Microsoft, for Windows Phone 7. I bought Windows Phone (HTC HD7) one month back, and it was amazing device. Since I’m a ASP.NET Web application developer and eager to develop web applications for Windows Phone 7.  

Developing ASP.NET Web application and testing those is pretty simple. Thanks to Microsoft once again, for providing free Visual Studio Express 2010 for Windows Phone absolutely free, which includes Windows Phone 7 emulator.

You can download Visual Studio Express 2010 for Windows Phone from this link.

Let us start writing a simple web application, which targets the Windows Phone 7. As usual, start Visual Studio 2008/2010, and create a ASP.NET website project, and add simple text as shown below.

image

Deploy the Web application to the local IIS Server, then try to access  web application in Windows Phone emulator, which I got with Visual Studio Express 2010 for Windows Phone. Here we go,

                                                    image

Oops, the text is showing very small, not able to read what it is. By default it renders like shown in the above emulator. Don’t worry, we can resolve this issue pretty easy with some cool META tags.

Just add any one of the  following META tags, in the head section of you page.

image

I added both the META tags, but one is sufficient. Now run this web app in Windows Phone emulator, here we go

                                    image

Woooww, it’s working. You are done, creating a simple web application for Mobile Phones. You can add all the ASP.NET controls, and all controls renders awesome in Windows Phone 7.

ASP.NET may fail to detect the Windows Phone browser as Mobile browser. To overcome this issue, your can use Mobile Device Detection code provided at http://51degrees.codeplex.com

Here’s an awesome example to detect the Mobile browsers and redirecting to a Mobile site etc.,

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

Happy Web App development for Windows Phones!!!

28 thoughts on “Developing ASP.NET Web Applications for Windows Phone 7

  1. Thanks for this post. But how can you add the asp.net controls to the windows phone contols or the toolbox. For instance, this does not have any label controls and so many other useful controls are missing from the windows phone toolbox!

  2. Thanks for the post. But how add a screen orientation to landscape or potrait in this application. Can anyone please help me in this context

  3. hi

    I have installed windows phone 7.1 sdk in windows 8 machine. I want to test my existing application in windows phone 7.1 emulator. How will i open the emulator and test it?

    1. Hi Suresh,

      Did you tried opening the emulator and navigate to you website, if it’s hosted on the Server. If it’s in your local, then you may have to host it in local IIS and access in the emulator as shown in the article.

      Hope it helps u…

  4. Have you ever thought about creating an e-book or guest authoring on other websites?
    I have a blog based on the same topics you discuss and would
    really like to have you share some stories/information.
    I know my viewers would enjoy your work. If you are even remotely interested, feel free
    to send me an email.

  5. Hi there! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing several
    weeks of hard work due to no back up. Do you have any methods to stop hackers?

  6. Thanks forr eveery other eexcellent article. The place elwe may
    anybody get that type of information in such an ideal way of writing?
    I have a presentation subsequent week, and I am at the look for such
    information.

  7. Hmm it looks like your site ate my first comment (it was super long) so I
    guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to the whole thing.

    Do you have any helpful hints for novice blog
    writers? I’d really appreciate it.

  8. Superb blog you have here but I was curious about if you knew of any message boards that cover the
    same topics talked about here? I’d really love to be a part
    of community where I can get responses from other experienced
    individuals that share the same interest. If you have
    any recommendations, please let me know. Thanks!

Leave a comment