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 / November 2005

Tip: Looking for answers? Try searching our database.

Detectif its a device or aweb browser and then redirect?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luis Esteban Valencia - 14 Dec 2004 19:50 GMT
I have a website for normal browsing with ASP.net! but I want that when
people targets at
www.mydomain.com the default.aspx detects if its a mobile or just a normal
browser and redirect to the appropiate file.

Signature

LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV

JuanDG - 14 Dec 2004 20:11 GMT
it's really simple thanks to the magic of the Device Capabilities Assessment
model of ASP.NET Mobile Web Forms.
all you have to do is ask in the "Page_Load" event of your Mobile Web Form,
if the requesting browser Is a Mobile Device.
Your code will look like this:

   public void Page_Load(Object sender, EventArgs e)
   {
       if (Request.Browser["IsMobileDevice"] == "true" )
       {
           Response.Redirect("MobileDefault.aspx");
       }
       else
       {
           Response.Redirect("DesktopDefault.aspx");
       }
   }

I'm preparing an article on the ASP.NET's Device Capabilities Assessment
Model for PanoramaBox, as soon as it's finished I'll let you know.

Take Care!!!!

--

Juan David Gomez A.
Microsoft Certified Professional
Analista de Desarrollo - PSL S.A.
Web and Wireless Banking
Medellin - Colombia

>I have a website for normal browsing with ASP.net! but I want that when
> people targets at
> www.mydomain.com the default.aspx detects if its a mobile or just a normal
> browser and redirect to the appropiate file.
Luis Esteban Valencia - 14 Dec 2004 21:39 GMT
thanks

Signature

LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV

> it's really simple thanks to the magic of the Device Capabilities Assessment
> model of ASP.NET Mobile Web Forms.
[quoted text clipped - 31 lines]
> > www.mydomain.com the default.aspx detects if its a mobile or just a normal
> > browser and redirect to the appropiate file.
Sacha Korell - 21 Dec 2004 19:08 GMT
This doesn't work for me.

Request.Browser("IsMobileDevice") returns false when connecting with my iPAQ
2215, although HTTPBrowserCapabilities "Platform" returns "WinCE".

What's going on? I'm using VS.NET2003 for development with DeviceUpdate4
installed.

I had a code snippet like:

If Not (Page.IsPostBack) Then
   If (Device.IsMobileDevice) Then
       RedirectToMobilePage("mobile/m_default.aspx")
   Else
       Response.Redirect("default.aspx")
   End If
End If

It used to work just fine, but now "Device.IsMobileDevice" also returns
false.

Any ideas?

Thanks,

Sacha

> it's really simple thanks to the magic of the Device Capabilities
> Assessment model of ASP.NET Mobile Web Forms.
[quoted text clipped - 32 lines]
>> normal
>> browser and redirect to the appropiate file.
esiquio@gmail.com - 21 Dec 2004 22:38 GMT
Sacha

IsMobileDevice not always is the best option( I keep getting false with
with pocketpc). The best option to find out if is a mobile device or
not is to obtain the OS.

if (Request.Browser.Platform.ToString().IndexOf("WinCE")>-1 ||
Request.Browser.Platform.ToString().IndexOf("Palm")>-1||
Request.Browser.Platform.ToString().IndexOf("Pocket")>-1){
Response.Redirect("MobileDefault.aspx");
}
else
{
Response.Redirect("DesktopDefault.aspx");
}

So if this if is true is a mobile device...probably there are more OS
around but to use a website with a pocketpc or palm this should work.

Have a great one. And I think this group is great, Congratulations to
everybody.
Jester - 07 Nov 2005 09:24 GMT
Personally, I use a combination of both to really be effective:

If Request.Browser("IsMobileDevice") = True Then
Response.Redirect("PDA.aspx")
ElseIf Request.Browser.Platform.ToString().IndexOf("WinCE")
-1 Or Request.Browser.Platform.ToString().IndexOf("Palm") > -1 O
Request.Browser.Platform.ToString().IndexOf("Pocket") > -1 Then
Response.Redirect("PDA.aspx")
Else
Response.Redirect("Default.aspx")
End I



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.