Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Mobile / September 2004

Tip: Looking for answers? Try searching our database.

PPC Emulator, Pocket IE, Browser Capabilities

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Isaac C. - 05 Sep 2004 16:33 GMT
Hello.  I have developed analagous ASP.NET and Mobile ASP.NET applications.  
I have this code snippet that examines the request's browser capabilities.  
Using the PPC emulator that came with the PPC 2003 SDK, "IsMobileDevice"
always comes back explicitly as false.  Is there something further I am
supposed to do? With machine.config perhaps?

       If (Request.Browser("IsMobileDevice") = "true") Then
           Response.Redirect("../MobileVersion/Default.aspx", True)
       Else
           Response.Redirect("../NonMobileVersion/Default.aspx", True)
       End If

--Isaac
Yan-Hong Huang[MSFT] - 06 Sep 2004 03:09 GMT
Hello Isasc,

Could you please try the following two methods?

1) Change web.config file:
Please try the following steps to solve the problem without changing the C#
code in the default.aspx.

1.    Open the web.config in notepad.
2.    Locate the following line in the config file:
   </system.web>
3.    Replace the line with the following text:
    <browserCaps>
          <use var="HTTP_USER_AGENT" as="user_agent" />
              <filter>
                   <case match="Windows CE" with="%{user_agent}">
                IsMobileDevice = "true"
                   </case>
               </filter>
    </browserCaps>
4.    Save the web.config.
5.    Browse the page again in Pocket PC 2003.

This config is to tell the system if the HTTP_USER_AGENT information
contains "Windows CE", we'd like to set the IsMobileDevice to true. So,
Request.Browser["IsMobileDevice"] will returns true if the HTTP_USER_AGENT
contains "Windows CE".

       if (Request.Browser["IsMobileDevice"] == "true") {
   
           Response.Redirect("MobileDefault.aspx");
       }
       else {
   
           Response.Redirect("DesktopDefault.aspx");
       }

For Pocket PC 2002/2003 and Smartphone 2003, the HTTP_USER_AGENT always
contains "Windows CE". This is why the above method works.

2) Another way you can try is to change C# code:

To solve the problem, please open the default.aspx page of the Portal and
locate the following code:
if (Request.Browser["IsMobileDevice"] == "true")
Replace the above code with the following solves the problem:
if (Request.Browser["IsMobileDevice"] == "true" ||
Request.Browser["Platform"] == "WinCE")

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ?C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
Yan-Hong Huang[MSFT] - 08 Sep 2004 07:01 GMT
Hello Isasc,

Do you have any more concerns on this issue? If the problem is not resolved
yet, please feel free to post here and we will follow up.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ?C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.