473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Session_OnStart does not start

Hi All,

The "Session_OnStart" event doesnot fire if the website has .htm file as the
startup document. If I change the extension of the default document from
..htm to .asp then I can see the event fires, But now I cant change the
default page to .asp.

How can I make the Session_OnStart fire in that situation? Please suggest.

Thanks
Prabhat


Sep 27 '05 #1
31 2906
Prabhat wrote on 27 sep 2005 in microsoft.public.inetserver.asp.general:
The "Session_OnStart" event doesnot fire if the website has .htm file
as the startup document. If I change the extension of the default
document from .htm to .asp then I can see the event fires, But now I
cant change the default page to .asp.

How can I make the Session_OnStart fire in that situation? Please
suggest.


I suppose you define .htm as an asp-page in iis.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 27 '05 #2

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
I suppose you define .htm as an asp-page in iis.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi, I did not get your point. can you please explain.

Thanks
Prabhat
Sep 27 '05 #3
As the page is static, why would you need to start a session for this htm
page ? It will start anyway the first time you hit a dynamic page...

The whole scenario could help but you could likely mess with the file
extension, have the htm file redirected to default.asp, using a "link" to a
dnyamic page from your htm page to trigger the start etc... For now I don't
see why you really need to open the session before you hit any dynamic
content...

--
Patrice

"Prabhat" <no********@hotmail.com> a écrit dans le message de
news:uj**************@TK2MSFTNGP15.phx.gbl...
Hi All,

The "Session_OnStart" event doesnot fire if the website has .htm file as the startup document. If I change the extension of the default document from
.htm to .asp then I can see the event fires, But now I cant change the
default page to .asp.

How can I make the Session_OnStart fire in that situation? Please suggest.

Thanks
Prabhat

Sep 27 '05 #4
"Patrice" <no****@nowhere.com> wrote in message
news:ug**************@TK2MSFTNGP10.phx.gbl...
As the page is static, why would you need to start a session for this htm
page ? It will start anyway the first time you hit a dynamic page...

The whole scenario could help but you could likely mess with the file
extension, have the htm file redirected to default.asp, using a "link" to a dnyamic page from your htm page to trigger the start etc... For now I don't see why you really need to open the session before you hit any dynamic
content...

--
Patrice


Hi Patrice,

Actually my home page is htm and I want to set some Session variable
whenever any body open the home page (like referral url) so that I can use
that in my application. I know that If i change the extension of the home
page to asp it will work, but that is not possible now. So can u suggest any
alternae so that my session will start.

I think i need to call some asp page from the html page but by staying in
the same html page. Please suggest.

Thanks
Prabhat
Sep 27 '05 #5
"Prabhat" <no********@hotmail.com> wrote in message
news:eC**************@TK2MSFTNGP12.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:ug**************@TK2MSFTNGP10.phx.gbl...
As the page is static, why would you need to start a session for this htm page ? It will start anyway the first time you hit a dynamic page...

The whole scenario could help but you could likely mess with the file
extension, have the htm file redirected to default.asp, using a "link"
to a
dnyamic page from your htm page to trigger the start etc... For now I don't
see why you really need to open the session before you hit any dynamic
content...

--
Patrice


Hi Patrice,

Actually my home page is htm and I want to set some Session variable
whenever any body open the home page (like referral url) so that I can use
that in my application. I know that If i change the extension of the home
page to asp it will work, but that is not possible now. So can u suggest

any alternae so that my session will start.

I think i need to call some asp page from the html page but by staying in
the same html page. Please suggest.

Thanks
Prabhat


You could include an image tag on your home page to invoke an
ASP page that sets the session variable. For example,

<img src="SetSesVar.asp" border="0" width="0" height="0" alt="">

Sep 27 '05 #6
IIS; default Web Site; Right-click; Properties; Home Diretcory TAB;
Configuration Button; App Mappings TAB...add extension .HTM to invoke asp.dll

Brian

Sep 27 '05 #7

"Brian Staff" <brianstaff AT [NoSpam]cox DOT net> wrote in message
news:VA******************@bstaffw2k.jda.corp.local ...
IIS; default Web Site; Right-click; Properties; Home Diretcory TAB;
Configuration Button; App Mappings TAB...add extension .HTM to invoke asp.dll
Brian


Hi Brian,

That is great. If I set the .htm to invoke asp.dll it is working for me.

But I have few doubts. Can u please help me in that?

1) This will work for any htm file invoked in that webserver will invoke
asp.dll. Can I set the samilar setting for any perticulatr website?
2) What all i can provide in the "Limit to" field?
3) I think that may lead to performance of the web server and also I am not
sure if the web hosting company will set that value for that default website
or not. And my main purpose is to capture the Referral URL. So is there any
other method you know?

Thanks
Prabhat
Sep 27 '05 #8

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:D5********************@comcast.com...
You could include an image tag on your home page to invoke an
ASP page that sets the session variable. For example,

<img src="SetSesVar.asp" border="0" width="0" height="0" alt="">

Hi, that will work fine and the session will start. Also I think i can use
like: <script language="javascript" src="StartSession.asp"></Script>. But
this will not give the exact referral page URL. This will give the url as
the homepage.htm.

Thanks
Prabhat


Sep 27 '05 #9
"Prabhat" <no********@hotmail.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:D5********************@comcast.com...
You could include an image tag on your home page to invoke an
ASP page that sets the session variable. For example,

<img src="SetSesVar.asp" border="0" width="0" height="0" alt="">

Hi, that will work fine and the session will start. Also I think i can use
like: <script language="javascript" src="StartSession.asp"></Script>. But
this will not give the exact referral page URL. This will give the url as
the homepage.htm.

Thanks
Prabhat


"I think i need to call some asp page from the html page"
was asked and answered.

You never mentioned the "referral page" before.

You'll have to provide more details as to what you want to do.
Sep 27 '05 #10

"McKirahan" <Ne**@McKirahan.com> wrote in message
news:xM********************@comcast.com...
"I think i need to call some asp page from the html page"
was asked and answered.

You never mentioned the "referral page" before.

You'll have to provide more details as to what you want to do.

Hi,

Yes getting the referral page from the website that has htm as the startup
document was my requirement.Your ans was correct as per my question, but I
could not get the session started when the htm file or wesite is opened from
the home page. Can you suggest any thing?

thanks
prabhat
Sep 28 '05 #11
As the html page is static I can't see how you'll be able to trigger the
code that will grab this info... It needs to be triggered by this exact
request as you are interested in a variable that is dependent upon the
current request.

The cleanest solution would be to change this page to an ASP page (I know
you said you can't).

Other solutions would be tricky and complex (for example you could try to
see if VBScript code in an HTM page once the HTM extension is handled by the
ASP dll (IMO it uses just the extension) or if i'ts possible to add another
extension for ASP pages. You could also handle the request to the htm page
and handles this behind the scene (dont'know exactly but likely needs to
write a complex DLL to do that). Also you should be able also to get this
info from the IIS log if this is just for statistics...

As a side note the referal is optional. Your application should be able to
run without this info.

Good luck.

--
Patrice

"Prabhat" <no********@hotmail.com> a écrit dans le message de
news:eC****************@TK2MSFTNGP12.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:ug**************@TK2MSFTNGP10.phx.gbl...
As the page is static, why would you need to start a session for this htm page ? It will start anyway the first time you hit a dynamic page...

The whole scenario could help but you could likely mess with the file
extension, have the htm file redirected to default.asp, using a "link"
to a
dnyamic page from your htm page to trigger the start etc... For now I don't
see why you really need to open the session before you hit any dynamic
content...

--
Patrice


Hi Patrice,

Actually my home page is htm and I want to set some Session variable
whenever any body open the home page (like referral url) so that I can use
that in my application. I know that If i change the extension of the home
page to asp it will work, but that is not possible now. So can u suggest

any alternae so that my session will start.

I think i need to call some asp page from the html page but by staying in
the same html page. Please suggest.

Thanks
Prabhat

Sep 28 '05 #12
Patrice wrote on 28 sep 2005 in microsoft.public.inetserver.asp.general:
As the html page is static I can't see how you'll be able to trigger
the code that will grab this info... It needs to be triggered by this
exact request as you are interested in a variable that is dependent
upon the current request.

The cleanest solution would be to change this page to an ASP page
(I know you said you can't).

Other solutions would be tricky and complex


I wouldn't say tricky:

add to your start.htm page:

<img src='/dummyjpg.asp' style='display:none;'>

and make a '/dummyjpg.asp' page containing only:

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

<%
response.end
%>
You don't need to send a .jpg, etc here!

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

The above will trigger the "Session_OnStart" event

However you don't need the "Session_OnStart" event,
as you can try this for '/dummyjpg.asp' page:

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

<%
if session("isNewSession") = "" then
session("isNewSession") = "noMore"
session("theNewsetVariable") = "Blah"
end if
response.end
%>
You don't need to send a .jpg, etc here!

=============
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 28 '05 #13
"Patrice" <no****@nowhere.com> wrote in message
news:Od*************@tk2msftngp13.phx.gbl...
As the html page is static I can't see how you'll be able to trigger the
code that will grab this info... It needs to be triggered by this exact
request as you are interested in a variable that is dependent upon the
current request.

The cleanest solution would be to change this page to an ASP page (I know
you said you can't).

Other solutions would be tricky and complex (for example you could try to
see if VBScript code in an HTM page once the HTM extension is handled by the ASP dll (IMO it uses just the extension) or if i'ts possible to add another extension for ASP pages. You could also handle the request to the htm page
and handles this behind the scene (dont'know exactly but likely needs to
write a complex DLL to do that). Also you should be able also to get this
info from the IIS log if this is just for statistics...

As a side note the referal is optional. Your application should be able to
run without this info.

Good luck.

--
Patrice


Hi,

Yes my website witll run without the referal url. and also I cant change the
home page to .asp.

But as per your suggestion (also suggested by Evertjan and Brian) I can set
the IIS (asp.dll) to invoke on htm request. But that will be a performance
problem (I think). And as the website is hosted with the ISP so he w'nt set
the asp.dll to execute on htm request.

I think Evertjan has a good point in his reply to this post.

Thanks
Prabhat
Sep 28 '05 #14

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
I wouldn't say tricky:

add to your start.htm page:

<img src='/dummyjpg.asp' style='display:none;'>

and make a '/dummyjpg.asp' page containing only:

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

<%
response.end
%>
You don't need to send a .jpg, etc here!

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

The above will trigger the "Session_OnStart" event

However you don't need the "Session_OnStart" event,
as you can try this for '/dummyjpg.asp' page:

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

<%
if session("isNewSession") = "" then
session("isNewSession") = "noMore"
session("theNewsetVariable") = "Blah"
end if
response.end
%>
You don't need to send a .jpg, etc here!

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

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Hi Evertjan, Thanks for this code.

I think I can do that in many ways, But still not able to get the best
solution yet for my requirement. Like:

1) I can do that If i set the asp.dll to invoke on htm request. So here the
session will start and my referral url will be set correctly. But it is
difficult to set the setting with ISP.

2) I can do as per you code here and can also do like:

Add a line of code in home page.htm
<script language="javascript" src="StartSession.asp"></Script>

in StartSession.asp I will not have only one line : <%@ Language=VBScript %>
so this will trigger the session_onstart. But if I try to get the referral
url in session_onstart then i will not get correct url. Because my asp file
was called by the home page so that will be my referral not the actual.

3) I can use Java Script on my Homepage like: document.referrer and I can
use the value in some asp file where I will set the referral url (Session
variable). But how do I pass that value to the asp page?

I think I am comming to the end but not with a best solution.

Thanks
Prabhat
Sep 28 '05 #15
The problem is that it will trigger another HTTP request. As he wants to
capture the refferer, it has to be the same HTTP request...

--
Patrice

"Evertjan." <ex**************@interxnl.net> a écrit dans le message de
news:Xn********************@194.109.133.242...
Patrice wrote on 28 sep 2005 in microsoft.public.inetserver.asp.general:
As the html page is static I can't see how you'll be able to trigger
the code that will grab this info... It needs to be triggered by this
exact request as you are interested in a variable that is dependent
upon the current request.

The cleanest solution would be to change this page to an ASP page
(I know you said you can't).

Other solutions would be tricky and complex


I wouldn't say tricky:

add to your start.htm page:

<img src='/dummyjpg.asp' style='display:none;'>

and make a '/dummyjpg.asp' page containing only:

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

<%
response.end
%>
You don't need to send a .jpg, etc here!

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

The above will trigger the "Session_OnStart" event

However you don't need the "Session_OnStart" event,
as you can try this for '/dummyjpg.asp' page:

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

<%
if session("isNewSession") = "" then
session("isNewSession") = "noMore"
session("theNewsetVariable") = "Blah"
end if
response.end
%>
You don't need to send a .jpg, etc here!

=============
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 28 '05 #16
You htm page could perhaps then alter the src attribute if the img tag
passing the referrer value on the querystring.
In the target ASP page you can then read the querystring to get the referrer
for the HTM page...

--
Patrice

"Prabhat" <no********@hotmail.com> a écrit dans le message de
news:Og**************@TK2MSFTNGP11.phx.gbl...

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
I wouldn't say tricky:

add to your start.htm page:

<img src='/dummyjpg.asp' style='display:none;'>

and make a '/dummyjpg.asp' page containing only:

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

<%
response.end
%>
You don't need to send a .jpg, etc here!

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

The above will trigger the "Session_OnStart" event

However you don't need the "Session_OnStart" event,
as you can try this for '/dummyjpg.asp' page:

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

<%
if session("isNewSession") = "" then
session("isNewSession") = "noMore"
session("theNewsetVariable") = "Blah"
end if
response.end
%>
You don't need to send a .jpg, etc here!

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

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
Hi Evertjan, Thanks for this code.

I think I can do that in many ways, But still not able to get the best
solution yet for my requirement. Like:

1) I can do that If i set the asp.dll to invoke on htm request. So here

the session will start and my referral url will be set correctly. But it is
difficult to set the setting with ISP.

2) I can do as per you code here and can also do like:

Add a line of code in home page.htm
<script language="javascript" src="StartSession.asp"></Script>

in StartSession.asp I will not have only one line : <%@ Language=VBScript %> so this will trigger the session_onstart. But if I try to get the referral
url in session_onstart then i will not get correct url. Because my asp file was called by the home page so that will be my referral not the actual.

3) I can use Java Script on my Homepage like: document.referrer and I can
use the value in some asp file where I will set the referral url (Session
variable). But how do I pass that value to the asp page?

I think I am comming to the end but not with a best solution.

Thanks
Prabhat

Sep 28 '05 #17

"Patrice" <no****@nowhere.com> wrote in message
news:#I**************@TK2MSFTNGP15.phx.gbl...
The problem is that it will trigger another HTTP request. As he wants to
capture the refferer, it has to be the same HTTP request...

Yes, you are right. It must be same request.

Thanks
Prabhat
Sep 28 '05 #18

"Patrice" <no****@nowhere.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
You htm page could perhaps then alter the src attribute if the img tag
passing the referrer value on the querystring.
In the target ASP page you can then read the querystring to get the referrer for the HTM page...


I was also thinking to get the referrer url using javascript and pass the
referer to asp file and set the Session varibale with the value. But my
problem is: I have set the Session("ReferralURL") variable in
Seesion_OnStart. And now I have write like:

if Session("ReferralURL") = "" then Session("ReferralURL") =
Request.QueryString(.......

But I have Session("ReferralURL") already there in session_ONStart so it
will set to homepage when ever I call the asp page from my homepage using
the src tag. What do you think?

I think you all are getting bore of this small issue. I am sorry for that
but I am not able to get the proper solution yet.

Thanks
Prabhat
Sep 28 '05 #19
Why do you need to do this in session_start ? Why can't you do that inside
the ASP page ? I would try without anything in Session_Start and would fill
the session variable with the querystring value in the ASP page itself...

Later you'll likely have to consider changing the HTM page to an ASP page
for a cleaner approach (don't know why you can't change. In case it's
because you don't have access to the server config, note that you could have
multiple documents i.e. it will use default.htm if available but could be
able to use default.asp if default.htm is deleted).

---
Patrice

"Prabhat" <no********@hotmail.com> a écrit dans le message de
news:uD**************@TK2MSFTNGP12.phx.gbl...

"Patrice" <no****@nowhere.com> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
You htm page could perhaps then alter the src attribute if the img tag
passing the referrer value on the querystring.
In the target ASP page you can then read the querystring to get the

referrer
for the HTM page...


I was also thinking to get the referrer url using javascript and pass the
referer to asp file and set the Session varibale with the value. But my
problem is: I have set the Session("ReferralURL") variable in
Seesion_OnStart. And now I have write like:

if Session("ReferralURL") = "" then Session("ReferralURL") =
Request.QueryString(.......

But I have Session("ReferralURL") already there in session_ONStart so it
will set to homepage when ever I call the asp page from my homepage using
the src tag. What do you think?

I think you all are getting bore of this small issue. I am sorry for that
but I am not able to get the proper solution yet.

Thanks
Prabhat

Sep 28 '05 #20
"Patrice" <no****@nowhere.com> wrote in message
news:#O**************@TK2MSFTNGP12.phx.gbl...
Why do you need to do this in session_start ? Why can't you do that inside
the ASP page ? I would try without anything in Session_Start and would fill the session variable with the querystring value in the ASP page itself...
Because my seesion start from many places of the website. All pages except
the home page are asp. SO Instead of doing that in asp page i preferred to
do in session_onStart. But my problem was i was not able to capture referral
url when the user enter using home page. If the session starts only in home
page then you are right and i should also set that in ASP page instead if
session_OnStart.
Later you'll likely have to consider changing the HTM page to an ASP page
for a cleaner approach (don't know why you can't change. In case it's
because you don't have access to the server config, note that you could have multiple documents i.e. it will use default.htm if available but could be
able to use default.asp if default.htm is deleted).

---
Patrice


I think having a htm / html as start page provide a greater index to search
engines then a asp as home page. I am not sure but I think i will not be
able to change thet htm to asp.

Thanks
Prabhat
Sep 28 '05 #21
Prabhat wrote on 28 sep 2005 in microsoft.public.inetserver.asp.general:
3) I can use Java Script on my Homepage like: document.referrer and I can
use the value in some asp file where I will set the referral url (Session
variable). But how do I pass that value to the asp page?

<body onload='
document.getElementById("im").src=
"/dummy.asp?ref=" + document.referrer
'>
<img id='im' style='display:none;'>

not tested

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 28 '05 #22

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
<body onload='
document.getElementById("im").src=
"/dummy.asp?ref=" + document.referrer
'>
<img id='im' style='display:none;'>

not tested

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


yes that should do that trick.

Thanks
Prabhat
Sep 28 '05 #23
> But as per your suggestion (also suggested by Evertjan and Brian) I can set
the IIS (asp.dll) to invoke on htm request. But that will be a performance
problem (I think). And as the website is hosted with the ISP so he w'nt set
the asp.dll to execute on htm request.


You might have a problem with your host (invoking asp.dll for an HTM request),
but performance will be non-existant. You will not be able to measure the
difference.

Brian
Sep 28 '05 #24
Ok and what do you have in your session variable ? IMO you'll have to test
that the session variable is not already set but also you'll have to test
that the referrer is not on your own site before taking it into account.

This way :
- if you hit the HTM page : the ASP "trick" page is called, it makes the
session start but the referrer (from ServerVariables) is not taken as it's
on your own site, the page runs and take the referrer into account (coming
from the QueryString)
- if you hit directly an ASP page, the session start and the referrer (from
ServerVariables) is taken into account as it's not on your site

As I said earlier, make sure you can play without this info as the browser
could not provide necessarily this info...

--
Patrice

"Prabhat" <no********@hotmail.com> a écrit dans le message de
news:eC**************@TK2MSFTNGP15.phx.gbl...
"Patrice" <no****@nowhere.com> wrote in message
news:#O**************@TK2MSFTNGP12.phx.gbl...
Why do you need to do this in session_start ? Why can't you do that inside the ASP page ? I would try without anything in Session_Start and would fill
the session variable with the querystring value in the ASP page itself...
Because my seesion start from many places of the website. All pages except
the home page are asp. SO Instead of doing that in asp page i preferred to
do in session_onStart. But my problem was i was not able to capture referral url when the user enter using home page. If the session starts only in home page then you are right and i should also set that in ASP page instead if
session_OnStart.
Later you'll likely have to consider changing the HTM page to an ASP
page for a cleaner approach (don't know why you can't change. In case it's
because you don't have access to the server config, note that you could

have
multiple documents i.e. it will use default.htm if available but could be able to use default.asp if default.htm is deleted).

---
Patrice


I think having a htm / html as start page provide a greater index to

search engines then a asp as home page. I am not sure but I think i will not be
able to change thet htm to asp.

Thanks
Prabhat

Sep 28 '05 #25
"Patrice" <no****@nowhere.com> wrote in message
news:OM*************@TK2MSFTNGP15.phx.gbl...
Ok and what do you have in your session variable ? IMO you'll have to test
that the session variable is not already set but also you'll have to test
that the referrer is not on your own site before taking it into account.

This way :
- if you hit the HTM page : the ASP "trick" page is called, it makes the
session start but the referrer (from ServerVariables) is not taken as it's
on your own site, the page runs and take the referrer into account (coming
from the QueryString)
- if you hit directly an ASP page, the session start and the referrer (from ServerVariables) is taken into account as it's not on your site

Hi Patrice, you are right. I should check what is in the url before I assign
that referrer url to the session veriable. So both the way it will work fine
and I will be done in that.
As I said earlier, make sure you can play without this info as the browser
could not provide necessarily this info...

--
Patrice


But I did not get the above line. Any how thanks.
Prabhat
Sep 28 '05 #26
"Brian Staff" <brianstaff AT [NoSpam]cox DOT net> wrote in message
news:VA******************@bstaffw2k.jda.corp.local ...
But as per your suggestion (also suggested by Evertjan and Brian) I can set the IIS (asp.dll) to invoke on htm request. But that will be a performance problem (I think). And as the website is hosted with the ISP so he w'nt set the asp.dll to execute on htm request.
You might have a problem with your host (invoking asp.dll for an HTM

request), but performance will be non-existant. You will not be able to measure the
difference.

Brian


Hi Brian, thanks for that info about performance. But yes you are right the
ISP will not agree to set to invoke the asp.dll for HTML pages :( But I
think as I discussed with Patrice and Evertjan that should do the trick.

Thanks
Prabhat
Sep 28 '05 #27

"Evertjan." <ex**************@interxnl.net> wrote
<body onload='
document.getElementById("im").src=
"/dummy.asp?ref=" + document.referrer
'>
<img id='im' style='display:none;'>

not tested

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan,

I have created one sample asp file Start.asp:

Start.asp
-----------
<%@ Language=VBScript %>
<%
dim sRef
sRef = Request.QueryString("ref")

Wfile="D:\test.txt"

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(Wfile,True)
a.WriteLine("URL : " & sRef)
a.Close

set a = nothing
set fs = nothing
%>
and called like :

<BODY onload='document.getElementById("im").src="/start.asp?ref=" +
document.referrer'>
<img id='im' style='display:none;'>

But I think it is not calling the ASP file as the test.txt does not get
created.

So I called like:

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<script language = javascript TYPE="TEXT/JAVASCRIPT" src='Start.asp?ref=' +
document.referrer ></script>

<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
if (document.referrer != '')
document.write('Thanks for visiting from ' + document.referrer)
else
document.write('NONE')
</SCRIPT>
</BODY>
</HTML>

It is creating the test.txt but no Referral URL. can you suggest?

Thanks
Prabhat
Sep 29 '05 #28
Prabhat wrote on 29 sep 2005 in microsoft.public.inetserver.asp.general:
<BODY onload='document.getElementById("im").src="/start.asp?ref=" +
document.referrer'>
<img id='im' style='display:none;'>

But I think it is not calling the ASP file as the test.txt does not
get created.


I have two solutions for you, both tested overhere on a distant ASP-site:

CLIENTSIDE REFERRER SOLUTION:

Try this for your test.html file:

==================
<BODY onload='document.getElementById("im").src="/dummyjpg.asp?ref=" +
document.referrer + "&random=" + Math.random()'>

<img src='' id='im' style='display:none;'>

<a href='show.asp'>show</a>
==================

the Math.random ensures the dummyjpg.asp is fetched every time
src='' is probably necessary.

Try this for your dummyjpg.asp file:

==================
<% Response.Expires = 0 %>
<%
if session("ref") = "" then
session("ref") = Request.QueryString("ref")
end if
%>
==================

And this for your show.asp file:

==================
<% Response.Expires = 0 %>
<%
response.write session("ref")
%>
==================

Mind:

If the test.html is callet from localhost, perhaps there is no referrer
string, so call this file from alother file on a server with:

<a href='http://www.myTestDomain.org/test1.html'>start the test</a>

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

SERVERSIDE REFERRER SOLUTION:

Try this for your test.html file:

==================
<BODY onload='document.getElementById("im").src=
"/dummyjpg.asp?random=" + Math.random()'>
<img src='' id='im' style='display:none;'>

<a href='show.asp'>show</a>
==================

Try this for your dummyjpg.asp file:

==================
<% Response.Expires = 0 %>
<%
if session("ref") = "" then
session("ref") = Request.ServerVariables("HTTP_REFERER")
end if
%>
==================

And this for your show.asp file:

==================
<% Response.Expires = 0 %>
<%
response.write session("ref")
%>
==================


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 29 '05 #29

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.242...
Prabhat wrote on 29 sep 2005 in microsoft.public.inetserver.asp.general:
<BODY onload='document.getElementById("im").src="/start.asp?ref=" +
document.referrer'>
<img id='im' style='display:none;'>

But I think it is not calling the ASP file as the test.txt does not
get created.


I have two solutions for you, both tested overhere on a distant ASP-site:

CLIENTSIDE REFERRER SOLUTION:

Try this for your test.html file:

==================
<BODY onload='document.getElementById("im").src="/dummyjpg.asp?ref=" +
document.referrer + "&random=" + Math.random()'>

<img src='' id='im' style='display:none;'>

<a href='show.asp'>show</a>
==================

the Math.random ensures the dummyjpg.asp is fetched every time
src='' is probably necessary.

Try this for your dummyjpg.asp file:

==================
<% Response.Expires = 0 %>
<%
if session("ref") = "" then
session("ref") = Request.QueryString("ref")
end if
%>
==================

And this for your show.asp file:

==================
<% Response.Expires = 0 %>
<%
response.write session("ref")
%>
==================

Mind:

If the test.html is callet from localhost, perhaps there is no referrer
string, so call this file from alother file on a server with:

<a href='http://www.myTestDomain.org/test1.html'>start the test</a>

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

SERVERSIDE REFERRER SOLUTION:

Try this for your test.html file:

==================
<BODY onload='document.getElementById("im").src=
"/dummyjpg.asp?random=" + Math.random()'>
<img src='' id='im' style='display:none;'>

<a href='show.asp'>show</a>
==================

Try this for your dummyjpg.asp file:

==================
<% Response.Expires = 0 %>
<%
if session("ref") = "" then
session("ref") = Request.ServerVariables("HTTP_REFERER")
end if
%>
==================

And this for your show.asp file:

==================
<% Response.Expires = 0 %>
<%
response.write session("ref")
%>
==================


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi Evertjan, I think I am makking you angry :( Sorry. And thanks for your
suggestions. I will try that now.

Thanks
Prabhat
Sep 29 '05 #30
Prabhat wrote on 29 sep 2005 in microsoft.public.inetserver.asp.general:
Hi Evertjan, I think I am makking you angry :( Sorry. And thanks for your
suggestions. I will try that now.


No, you don't.

I am learning too!

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 29 '05 #31

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
No, you don't.

I am learning too!

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


Hi,

Thanks for that code samples. Actually the Client side code is what I was
looking for. I have just tested the files in remote site and it is working
fine. But not working in local site (i have not used localhost in local,
instead used computer name). Ok any how I will find the cause of that. Any
how that need to be implemented in remote not local.

Thanks Evertjan
Prabhat


Sep 29 '05 #32

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

54
by: seberino | last post by:
Many people I know ask why Python does slicing the way it does..... Can anyone /please/ give me a good defense/justification??? I'm referring to why mystring gives me elements 0, 1, 2 and 3...
3
by: Steve Mauldin | last post by:
This is a standard ASP application that has several pages at the root withthe global.asa. I set a session variable session("accountid") = "123456" within an asp page and then response.redirect to...
0
by: wannaknow | last post by:
When I set a cookie in global.asa in the sub session_onstart, even if I have "privacy" in IE 6.X set to "block all cookies" the cookie is still set, and I can get it on other pages. I can't find...
0
by: bb | last post by:
Hello In my Session_OnStart in Global.asa, I am setting some cookies. One of them, I set as follows: dim UserID UserID = Request.ServerVariables("LOGON_USER") Response.Cookies("User")("ID")...
2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
1
by: Suman | last post by:
We are facing a problem with a Service we developed. It does not start after a re-boot. We can Start/Stop the service from the interfacing Application and the Services Control Panel all day long....
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
2
by: parkchan | last post by:
Hi all, I've got an weird problem with Application variables in Global.asax.vb. I have three Application variables set up in Session_OnStart event and I'm displaying the values of those...
2
by: femina | last post by:
I am trying to work out an example in ASP.NET i have problem with the session_onstart in the global.asax file the "UsersOnline" doesnt get updated when i request the webpage again(if iam wrong) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.