Detectif its a device or aweb browser and then redirect?

Discussion in 'ASP .Net Mobile' started by Luis Esteban Valencia, Dec 14, 2004.

  1. 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, Dec 14, 2004
    #1
    1. Advertising

  2. Luis Esteban Valencia

    JuanDG Guest

    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" <> wrote in message
    news:...
    >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
    >
    >
    JuanDG, Dec 14, 2004
    #2
    1. Advertising

  3. thanks

    --
    LUIS ESTEBAN VALENCIA
    MICROSOFT DCE 3.
    MIEMBRO ACTIVO DE ALIANZADEV
    "JuanDG" <> escribió en el mensaje
    news:...
    > 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" <> wrote in message
    > news:...
    > >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, Dec 14, 2004
    #3
  4. Luis Esteban Valencia

    Sacha Korell Guest

    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" <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >>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, Dec 21, 2004
    #4
  5. Luis Esteban Valencia

    Guest

    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.
    , Dec 21, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    258
  2. Greg Hauptmann
    Replies:
    12
    Views:
    185
    Peter Szinek
    Apr 28, 2008
  3. thunk
    Replies:
    1
    Views:
    292
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    453
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    599
    thunk
    Apr 3, 2010
Loading...

Share This Page