.NETGURU
PPC Emulator, Pocket IE, Browser Capabilities
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.mobile.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Isaac C.
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

Reply to this message...
 
    
Yan-Hong Huang[MSFT] (VIP)
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.

Reply to this message...
 
    
Yan-Hong Huang[MSFT] (VIP)
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.

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification