-
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.
-
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.
>
>
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks