I an ASP page how do i find that the page is Accessed from PC or Mobile phone


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: I an ASP page how do i find that the page is Accessed from PC or Mobile phone

Hybrid View

  1. #1
    Ghanta Sunil Krishna Guest

    I an ASP page how do i find that the page is Accessed from PC or Mobile phone


    hi,
    i am sunil,working as a Software programmer. Well i do have a question
    for u. Consider this scenario.

    Step 1:
    I have a asp page which queries the database using ADO 2.5 to retrieve the
    data.

    Example:-rs.open "select statement"

    Step 2:
    Suppose the request came from a pc then i wanna apply one style sheet(XSL)
    or else if the request came from a mobile phone i should apply another style
    sheet.That is done like this:

    If Pc then
    response.write PC.xsl
    else if mobile phone then
    response.write mobile.xsl
    end if

    Step 3:
    Then i save my recordset to response object.

    Example:-rs.save response,adpersistxml


    This is fine .But in Step2 how do i find out where the request came from
    so that i can apply different style sheets to my xml content.



  2. #2
    peedebee Guest

    Re: I an ASP page how do i find that the page is Accessed from PC or Mobile phone


    Don't really understand problem, because if you test on 'if pc', then you
    must have had a something to test this against. Anyway, it might be just
    an example. You might want to check the HTTP-headers if you don't know where
    request is coming from. Or try browserhawk from Cyscape. They have a fixed
    set of properties ('PDA, WAP') to check where request came from.

    "Ghanta Sunil Krishna" <ghantasunil@usa.net> wrote:
    >
    >hi,
    > i am sunil,working as a Software programmer. Well i do have a question
    >for u. Consider this scenario.
    >
    >Step 1:
    > I have a asp page which queries the database using ADO 2.5 to retrieve

    the
    >data.
    >
    > Example:-rs.open "select statement"
    >
    >Step 2:
    > Suppose the request came from a pc then i wanna apply one style sheet(XSL)
    >or else if the request came from a mobile phone i should apply another

    style
    >sheet.That is done like this:
    >
    > If Pc then
    > response.write PC.xsl
    > else if mobile phone then
    > response.write mobile.xsl
    > end if
    >
    >Step 3:
    > Then i save my recordset to response object.
    >
    > Example:-rs.save response,adpersistxml
    >
    >
    >This is fine .But in Step2 how do i find out where the request came from
    >so that i can apply different style sheets to my xml content.
    >
    >



  3. #3
    KC Guest

    Re: I an ASP page how do i find that the page is Accessed from PC or Mobile phone

    You would need to check the HTTP-headers for the same.

    This checks if the request came from a phone ... and that too a Nokia phone.
    You can redirect or do whatever you want after that.

    str = Request.ServerVariables("HTTP_USER_AGENT")
    if instr(str,"Nokia") Then
    Response.Redirect "wap.htm"
    else
    Response.redirect "default.htm"
    end if

    Cheers
    KC
    Ghanta Sunil Krishna <ghantasunil@usa.net> wrote in message
    news:3a41ccd1$1@news.devx.com...
    >
    > hi,
    > i am sunil,working as a Software programmer. Well i do have a question
    > for u. Consider this scenario.
    >
    > Step 1:
    > I have a asp page which queries the database using ADO 2.5 to retrieve the
    > data.
    >
    > Example:-rs.open "select statement"
    >
    > Step 2:
    > Suppose the request came from a pc then i wanna apply one style sheet(XSL)
    > or else if the request came from a mobile phone i should apply another

    style
    > sheet.That is done like this:
    >
    > If Pc then
    > response.write PC.xsl
    > else if mobile phone then
    > response.write mobile.xsl
    > end if
    >
    > Step 3:
    > Then i save my recordset to response object.
    >
    > Example:-rs.save response,adpersistxml
    >
    >
    > This is fine .But in Step2 how do i find out where the request came from
    > so that i can apply different style sheets to my xml content.
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center