global.asa fires after url parameters?

W

WaterBug

When clicking on the following link from an email i.e -
http://myserver/myapplication/myprogram.asp?urlvar1=some stuff&urlvar2=more stuff
I get a server 500 error. With that same browser window open, if I click
the link from the email again I get the desired page. The results are the
same if the url is copied and pasted into the brower but the 'go' must be
pressed twice.

It appears that the server is trying to resolve the url vars before the
global.asa is fired. Does anyone know of the order of processing? Any
suggestions?
 
E

Evertjan.

=?Utf-8?B?V2F0ZXJCdWc=?= wrote on 16 mrt 2005 in
microsoft.public.inetserver.asp.general:
When clicking on the following link from an email i.e -
http://myserver/myapplication/myprogram.asp?urlvar1=some stuff&urlvar
2=more%20stuff I get a server 500 error. With that same browser
window open, if I click the link from the email again I get the
desired page. The results are the same if the url is copied and
pasted into the brower but the 'go' must be pressed twice.

This is a emailclient cum browser issue, IMHO

It appears that the server is trying to resolve the url vars before
the global.asa is fired. Does anyone know of the order of processing?
Any suggestions?

global.asa does not fire every time a page is called, only at a [re]start
of the server/IIS.

Why do you think global.asa has anything to do with it?
Try the same without any global.asa present.
 
W

WaterBug

E: This is a emailclient cum browser issue, IMHO
W: I don't believe this is an emailclient issue. I can create the problem
without email. If you start a new browser and paste the url with the
urlvariables then the error occurs. The page requires the URL variables to
locate the specific recordset from the database and the session must be
started prior to that to establish connectionString, who you are, your
security, and more.

E: global.asa does not fire every time a page is called, only at a [re]start
of the server/IIS.
W: It fires every time I open a new browser and call my application. It
starts a new unique session for each browser conversation with the
application. This is only an issue if a session is not established.

E: Why do you think global.asa has anything to do with it? Try the same
without any global.asa present.
W: My app won't work without global.asa present. I rely on many session
vars for db connectivity and resolving security.

W: I think it is global.asa since the first time I type in the url and press
'go' or enter I get the error but the second time I press 'go' or enter the
page is delivered correctly. I think on the first trip to the server, the
server 1) attempts to resolve the url vars first, 2) then processes the
global.asa, 3) then attempts to deliver my page but my url vars are no longer
available. On the 2nd trip to the server, the session was established in the
1st trip and now the url vars are resolved correctly.

I am still in search of the order of processing by the server for an asp
request.
 
T

Tim

WaterBug said:
E: This is a emailclient cum browser issue, IMHO
W: I don't believe this is an emailclient issue. I can create the problem

Not a big issue but I suggest using ordinare quoting (like I do here) in
the future to increase the chance of good responses.
without email. If you start a new browser and paste the url with the
I dontt think this is not an email program issue
E: global.asa does not fire every time a page is called, only at a [re]start
of the server/IIS.
W: It fires every time I open a new browser and call my application. It
starts a new unique session for each browser conversation with the
application. This is only an issue if a session is not established.

Application_OnStart fires only when your application starts, that is
generally only the first time a page is requested after you have made
changes to global.asa.
E: Why do you think global.asa has anything to do with it? Try the same
without any global.asa present.
W: My app won't work without global.asa present. I rely on many session
vars for db connectivity and resolving security.

Session_OnStart is caled once when a new session starts. This means, if
you browse the site, Session_onstart is only called the fist time you go
to the first page.

A new session might start when you start another webbrowser but I guess
that is a settings thing?

Anyway,
I am still in search of the order of processing by the server for an
asp request.
It appears that the server is trying to resolve the url vars before the
global.asa is fired. Does anyone know of the order of processing? Any
suggestions?

The url vars are never automatically resolved.

If it is a new session, session_onstart is called first, in there you
might resolve the url vars with request.querystring if you want.

When session_onstart is ran to the end (or imediatley if this is your
second request) your asp page will be compiled and run from the top to
the bottom.

If you post the content of your global asa and myprogram.asp I am sure
it will be much easier to spot the error.

Tim
 
E

Evertjan.

Dear waterbug,

Tim wrote on 16 mrt 2005 in microsoft.public.inetserver.asp.general:
Session_OnStart is caled once when a new session starts. This means,
if you browse the site, Session_onstart is only called the fist time
you go to the first page.

Tim is right. [also on the quoting issue, but that aside]

The fact that Session_OnStart is called at the beginning of every new
session does not mean that global.asa is run. Global.asa runs only at
the application start. Session_OnStart sub is helt in memory.

I suppose your problem is a session problem. If the session is not helt,
because the browser does not allow a ram-cookie, every page is a new
session with a new call to the Session_OnStart sub. ASP pages are always
a session.

However without relevant code we cannot envision the exact nature of
your problem.

btw, did you try to debug?

========================

And you initialize those session variables [we are talking session() ?]
in Session_OnStart?

Why?
They can more easily be initialized on your entry page, easying the
debugging process. Or if you have multiple entry possiblilities, with a
include statement.

That way you can have administrative entry using a different security
appoach for your own purpose. Or differnt [open?] pages in another part
of your site.
 
W

WaterBug

Let me try to rephrase my problem. On a page call that invokes a new unique
application/session, the included query string (URL parameters) that are
passed are trashed, ignored, stripped (however you want to say it). Is it
true that the server's asp process will ignore URL variables if the page
invokes a new session? Is it impossible to refer to URL parameters on the
page that starts a session. It appears I am unable to refer to URL
parameters in an asp page that invokes a session.
 
B

Bob Barrows [MVP]

WaterBug said:
Let me try to rephrase my problem. On a page call that invokes a new
unique application/session, the included query string (URL
parameters) that are passed are trashed, ignored, stripped (however
you want to say it). Is it true that the server's asp process will
ignore URL variables if the page invokes a new session? Is it
impossible to refer to URL parameters on the page that starts a
session. It appears I am unable to refer to URL parameters in an asp
page that invokes a session.

Create a small page (or set of pages) that illustrates your problem. This
description is hard to follow.
 
W

WaterBug

The browser call..
http://127.0.0.1/MyApp/EvalPage.asp?trainee=astronaut&evaluator=kelly&type=orbit

MyApp is defined as an application in IIS...

The contents of EvalPage.asp...
<%@ Language=VBScript %>
<%option explicit

response.Write "Trainee= " & request("trainee") & " Evaluator= " &
request("evaluator") & " type= " & request("type")

response.Write "<br>query_string= " & request.ServerVariables("query_string")
response.Write "<br>request_uri= " & request.ServerVariables("request_uri")
response.Write "<br>path_info= " & request.ServerVariables("path_info")
response.Write "<br>path_translated= " &
request.ServerVariables("path_translated")
response.Write "<br>http_host= " & request.ServerVariables("http_host")
response.Write "<br>http_referer= " & request.ServerVariables("http_referer")
response.Write "<br>path= " & request.ServerVariables("path")
%>

The first time the URL listed above is requested the query_string is
returned as an empty string. Repaste the URL (cause the query_string gets
stripped) and the query_string is returned...k
 
P

Patrice

You can. IMO the problem is rather that you have some error in your
global.asa file having then an error just when the session starts...

You should start by disabling simplified HTTP errors to that you can clearly
see what this 500 error is exactly...

Patrice
 
B

Bob Barrows [MVP]

WaterBug said:
The browser call...
http://127.0.0.1/MyApp/EvalPage.asp?trainee=astronaut&evaluator=kelly&type=orbit

MyApp is defined as an application in IIS...

The contents of EvalPage.asp...
<%@ Language=VBScript %>
The first time the URL listed above is requested the query_string is
returned as an empty string.

By "returned", do you mean the

response.Write "query_string= " & _
request.ServerVariables("query_string")

statement writes an empty string?

No, that does not happen to me. I'm using IE6 on a Win2000 machine. What are
you using?

Bob Barrows
 
W

WaterBug

Bob Barrows said:
By "returned", do you mean the

response.Write "query_string= " & _
request.ServerVariables("query_string")

statement writes an empty string?

No, that does not happen to me. I'm using IE6 on a Win2000 machine. What are
you using?

The first paste of the URL
(http://127.0.0.1/MyApp/EvalPage.asp?
trainee=astronaut&evaluator=kelly&type=orbit)
into the Address line of the browser writes query_string as an empty string
(or query_string=) . When pasting the URL into the address line the second
time (thus requesting a second trip to the server) the browser writes
query_string= trainee=astronaut&evaluator=kelly&type=orbit
 
B

Bob Barrows [MVP]

WaterBug said:
The first paste of the URL
(http://127.0.0.1/MyApp/EvalPage.asp?
trainee=astronaut&evaluator=kelly&type=orbit)
into the Address line of the browser writes query_string as an empty
string (or query_string=) . When pasting the URL into the address
line the second time (thus requesting a second trip to the server)
the browser writes query_string=
trainee=astronaut&evaluator=kelly&type=orbit

As I said: it does not happen to me. I agree with the others: you have a
problem in your global.file.
 
W

WaterBug

I have recreated a project in Visual Studio 2003 and everything works fine
when there is no global.asa. When I add a global.asa that does very little
or an empty global.asa then the page url variables are not recognized during
the first load. The behavior is again demonstrated that only during the
second load does the query_string get recognized. Can one of you add an
empty global.asa in your project to see if this 'breaks' it? Thanks...k
 
P

Patrice

No problem here. What if you use Request.QueryString ?

Try also with an emply global.asa (rather than with doing a minimal amount
for things we have no idea about).

Are you sure this is not a cache issue ?

Patrice
 
M

Mark Schupp

Don't make us guess what you mean by "empty global.asa". Post the global.asa
code that causes the problem for you.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
 
B

Bob Barrows [MVP]

All of my projects have a global.asa file, including the one I tested your
code with.

Bob Barrows
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top