[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Detectif its a device or aweb browser and then redirect?

Luis Esteban Valencia

12/14/2004 7:50:00 PM

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
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV


4 Answers

JuanDG

12/14/2004 8:11:00 PM

0

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

"Luis Esteban Valencia" <luisvalen@haceb.com> wrote in message
news:uJLg6Yh4EHA.3376@TK2MSFTNGP12.phx.gbl...
>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
> MICROSOFT DCE 3.
> MIEMBRO ACTIVO DE ALIANZADEV
>
>


Luis Esteban Valencia

12/14/2004 9:39:00 PM

0

thanks

--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
"JuanDG" <jdgx@hotmail.com> escribi&#243; en el mensaje
news:OeBWIkh4EHA.604@TK2MSFTNGP10.phx.gbl...
> 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
>
> "Luis Esteban Valencia" <luisvalen@haceb.com> wrote in message
> news:uJLg6Yh4EHA.3376@TK2MSFTNGP12.phx.gbl...
> >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
> > MICROSOFT DCE 3.
> > MIEMBRO ACTIVO DE ALIANZADEV
> >
> >
>
>


Sacha Korell

12/21/2004 7:09:00 PM

0

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



"JuanDG" <jdgx@hotmail.com> wrote in message
news:OeBWIkh4EHA.604@TK2MSFTNGP10.phx.gbl...
> 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
>
> "Luis Esteban Valencia" <luisvalen@haceb.com> wrote in message
> news:uJLg6Yh4EHA.3376@TK2MSFTNGP12.phx.gbl...
>>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
>> MICROSOFT DCE 3.
>> MIEMBRO ACTIVO DE ALIANZADEV
>>
>>
>
>


Jester

11/7/2005 9:24:00 AM

0


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 Or
Request.Browser.Platform.ToString().IndexOf("Pocket") > -1 Then
Response.Redirect("PDA.aspx")
Else
Response.Redirect("Default.aspx")
End If



--
Jester
------------------------------------------------------------------------
Posted via http://www.codeco...
------------------------------------------------------------------------