Forum Moderators: open

Message Too Old, No Replies

AOL enviro variables

         

stn24

6:27 pm on Feb 18, 2001 (gmt 0)



I run ASP on IIS connected to SQL. My cloaking script requests uses - Request.ServerVariables to get : SCRIPT_NAME, REMOTE_HOST, REMOTE_ADDR, HTTP_USER_AGENT, HTTP_REFERER, HTTP_FROM, and HTTP_VIA. This information is passed on to a stored procedure which evaluates whether it is a spider or not. If I decide that it is a spider I read in optimized page, for humans I just redirect (is it better to read it in too?-unidentified spider get redirected).

My problem seems to be with AOL users. AOL users get this error: /index.asp?¦61¦800a0d5d¦application_uses_a_value_of_the_wrong_type_for_the_current_operation.

Is it one of the variables that's messing things up?

Thanks for the help.

JuniorHarris

7:55 pm on Feb 18, 2001 (gmt 0)

10+ Year Member



My first guess would be that for some reason one of these ServerVariables is causing the problem. Either it's blank or not handled properly by the script. Looks like an error on line 61 of the script. If you can check out that line. Most likely that will show you the variable in question...if you can't understand why it's bombing, then maybe check the user agent and skip or patch that value.

stn24

9:22 pm on Feb 18, 2001 (gmt 0)



Thanks for the tip.

The line 61 is for the stored procedure parameter input that takes the HTTP_VIA.

This error occurs ONLY for AOL users, for everyone else it works like swiss watch.

I'll take the HTTP_VIA right out as I currently don't use it anyway.

Air

9:56 pm on Feb 18, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is likely one of the variables, but I'll bet it isn't happening for all AOL hits. I'm guessing, but likely it is when the AOL proxy spider hits to retrieve pages for their cache. Consider these two actual hits:

Here is a normal hit from an AOL user:

Request: [[edit].com...]
User Agent: Mozilla/4.0 (compatible; MSIE 5.5; AOL 5.0; Windows 98)
IP Address: 152.163.188.65

Action: Open Visitor Directory
Action: Serve /page-edit.html to Mozilla/4.0 -- AOL 5.0 -- Windows 98
Action: Here are the env variables captured:

HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*
HTTP_ACCEPT_LANGUAGE = en-us
HTTP_CONNECTION =
HTTP_REFERER = [[edit].com...]
HTTP_HOST = www.[edit].com
HTTP_USER_AGENT = Mozilla/4.0 (compatible; MSIE 5.5; AOL 5.0; Windows 98)
QUERY_STRING =
CONTENT_TYPE =
HTTP_COOKIE =
HTTP_FROM =
REMOTE_IDENT =
REMOTE_USER =
REQUEST_METHOD = GET
SERVER_PROTOCOL = INCLUDED

And here is a hit from the "proxy" spider:

Request: [[edited].com...]
User Agent:
IP Address: 152.163.188.229

Action: Open Default Directory
Action: Serve /index.html to [Unknown]
Action: Here are the env variables captured:

HTTP_ACCEPT =
HTTP_ACCEPT_LANGUAGE =
HTTP_CONNECTION =
HTTP_REFERER =
HTTP_HOST = www.[edited].com
HTTP_USER_AGENT =
QUERY_STRING =
CONTENT_TYPE =
HTTP_COOKIE =
HTTP_FROM =
REMOTE_IDENT =
REMOTE_USER =
REQUEST_METHOD = GET
SERVER_PROTOCOL = INCLUDED

Notice just about every ENV variable is blank in the "proxy" spider hit, whereas in the "normal" hit the variables you'd expect are there. It could be one of those blank vars that is causing a problem.

Air

10:00 pm on Feb 18, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like I took too long to answer, sorry was composing while watching the Daytona 500 and your post got in there before I was done. Glad you found the var causing problems.

stn24

11:38 pm on Feb 18, 2001 (gmt 0)



Thanks anyway,

It wouldn't be beacause some vars were empty. All sessions have at least 1 of the vars empty. I set them all to blank before adding the actual variable. I think what it more likely was that the HTTP_VIA in some cases went through some strange server with a very long name, larger than I alloted.

Thank you all for the input. :)

Xoc

12:27 am on Feb 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One thing I'd like to point out when using ASP for cloaking. If you are running IIS 5.x on Windows 2000, there is the new Server.Transfer method. This does a redirection on the server side, instead of sending a redirection command down to the client. This is perfect for doing cloaking.

JuniorHarris

2:49 am on Feb 19, 2001 (gmt 0)

10+ Year Member



Whoops!~ Needed to stop by sooner.

Air very interesting observation!~ Thanks.

stn24, StoredProc, I thought that error looked familiar. I test all my vars for null before passing/executing a stored procedure. If it's null, I set the value as a 'space'. Also, I use the mid(string,length) function to limit/check the string size.

JuniorHarris

3:55 am on Feb 20, 2001 (gmt 0)

10+ Year Member



Using the Server.Transfer is great, but my problem is it does not allow the use of query strings in the transfer URL.

Without query strings, I'm forced to load any values to be passed into session variables. But, I've had a few problems with AOL sessions.

If I need to 'redirect' and pass values using a query string, I use ASPTear [alphasierrapapa.com] instead. This free software creates an object which allows any url with query strings to be read, and returns the entire page into a string. Then I simply Response.Write the string..basically what I call Cloaked Redirection.

Acknowledge there may be a slight performance hit compared to using the Server.Transfer object, but it may be worth it to allow the use of query strings and avoid the use of session variables.

stn24

10:48 pm on Feb 20, 2001 (gmt 0)



Thanks for the Server.Transfer tip xoc, it works very well. This feature makes my hard written scripts useless.

One more question : Does someone know where to download programming reference for ASP 3.0 - sort of like SQLbol.chm is for SQL. I looked around ms.com but can't seem to find it.

Xoc

12:31 am on Feb 21, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of reference are you looking for? VBScript? Information on the IIS server-side objects?

Almost everything on Microsoft products can be found using the search tool at [search.microsoft.com...] if you look hard enough.

VarkPan

3:44 pm on Feb 28, 2001 (gmt 0)



Try

[stardeveloper.com...]

For a basic ASP 3.0 reference