POST Form

D

Douglas

Gday all,

I have a login page, with

<input name="USER" type="text">
<input name="PASS" type="password">

This login page is hosted on a couple of different domain names.

What i'd like to do is append the domain name to the USER field.

I /think/ I need to use Request.ServerVariables("HTTP_HOST") but the bit i'm
stuck at is how to append the domain name to the FORM's USER field.

Thanks in advance,
-Douglas
 
S

Steven Burn

<%
Dim strHost
strHost = request.servervariables("HTTP_REFERER")
strUser = request.form("USER") & "_" & strHost
%>

The reason I've used HTTP_REFERER instead is simply because you need to know
where the form was submitted from. Though you could always replace
HTTP_REFERER with HTTP_HOST if you wish.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
D

Douglas

GDay Peter :)

I cant alter the receiving page, because the page that does the processing
is a third party compiled application with a webserver component that
expects data in a fixed format.

Chears,
-Douglas
 
D

Douglas

!idea... (i think)

if i can make my own processing page that takes care of these issues, all i
need to do is work out how to POST the data to the processing page.

this would require (fantasy-land idea..) a Hidden Field of type "Submit" ??


-Douglas
 
S

Steven Burn

How does this third party app require the form be submitted? (i.e. does it
use the satndard request.form or does it accept querystrings?). If it allows
querystrings then you could simply post the form to your own processing page
and do a response.redirect in the following manner;

<%
Dim strHost
strHost = request.servervariables("HTTP_REFERER")
strUser = request.form("USER") & "_" & strHost

response.redirect "http://www.somedomain.com/thepage.asp?q=" & strUser
%>

Can't guarantee it'll work as it all depends on how this third party app
requires the form be submitted.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
E

Evertjan.

Douglas wrote on 06 apr 2004 in microsoft.public.inetserver.asp.general:
I cant alter the receiving page, because the page that does the
processing is a third party compiled application with a webserver
component that expects data in a fixed format.

<form onsubmit="this.USER.value +=
'<%=Request.ServerVariables("HTTP_HOST")%>'">
<input name="USER" type="text">
<input name="PASS" type="password">
<input type=submit>
</form>
 
D

Douglas

Unfortunately not...

here's the original html from the 3rd Party app...


<form name="login" action="/dologin" method=post>


-Douglas
 
S

Steven Burn

In that case, you may want top try Evertjan's suggestion ;o)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 
D

Douglas

Thanks Evertjan,

That works great :)

only one thing... do you know off the top of yer head...

i need to remove the domain prefix from the HTTP_HOST...

ie: remove all text from the left of the string
up to the first decimal point

<-remove.keep->
www.somedomain.com
another.differentdomain.com

how might i do this with the JavaScript ?

Thanks very much for your help,
-Douglas
 
D

Douglas

Hey that looks neat ;)

I'll give it a go ...


(woops I typed this hours ago and forgot to send it in my excitemnt ... duh)
 
D

Douglas

Gday Peter,

Yep thats the idea, just gotta figure out how to code the interim page so
that it doesn't require the user's input (pressing Submit button etc)

-Douglas
 
E

Evertjan.

Douglas wrote on 06 apr 2004 in microsoft.public.inetserver.asp.general:
only one thing... do you know off the top of yer head...

i need to remove the domain prefix from the HTTP_HOST...

ie: remove all text from the left of the string
up to the first decimal point

I suppose up and including ?
<-remove.keep->
www.somedomain.com
another.differentdomain.com

how might i do this with the JavaScript ?

t = "aaa.bbb.ccc"
t = t.replace(/[^\.]+\./,"")
alert(t)

or

t = "aaa.bbb.ccc"
t = t.split('.').slice(1).join(".")
alert(t)

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

Why not do that serverside ?

vbs example:

<%
t = "aaa.bbb.ccc"
t = mid(t,instr(t,".")+1)
%>
 
D

Douglas

Gday Evertjan,

Thanks mate loox great :)

would have taken me a century to figure that one out ;)

t = "aaa.bbb.ccc"
t = t.replace(/[^\.]+\./,"")
alert(t)

looks a lot like a regex hmmm
Why not do that serverside ?

as i mentioned in one of my other posts, I don't have the opportunity to
alter the 'receiving/processing' page, as it is a third party app with
webserv inbuilt.

thanks again,
-Douglas

Evertjan. said:
Douglas wrote on 06 apr 2004 in microsoft.public.inetserver.asp.general:
only one thing... do you know off the top of yer head...

i need to remove the domain prefix from the HTTP_HOST...

ie: remove all text from the left of the string
up to the first decimal point

I suppose up and including ?
<-remove.keep->
www.somedomain.com
another.differentdomain.com

how might i do this with the JavaScript ?

t = "aaa.bbb.ccc"
t = t.replace(/[^\.]+\./,"")
alert(t)

or

t = "aaa.bbb.ccc"
t = t.split('.').slice(1).join(".")
alert(t)

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

Why not do that serverside ?

vbs example:

<%
t = "aaa.bbb.ccc"
t = mid(t,instr(t,".")+1)
%>
 
E

Evertjan.

Douglas wrote on 07 apr 2004 in microsoft.public.inetserver.asp.general:
I said:
as i mentioned in one of my other posts, I don't have the opportunity
to alter the 'receiving/processing' page, as it is a third party app
with webserv inbuilt.

Sure, but if you are using:
<form onsubmit="this.USER.value +=
'<%=Request.ServerVariables("HTTP_HOST")%>'">
<input name="USER" type="text">
<input name="PASS" type="password">
<input type=submit>
</form>


then you could also do this part serverside:

<%
host = Request.ServerVariables("HTTP_HOST")
host = mid(host,instr(host,".")+1)
%>

<form onsubmit="this.USER.value += '<%=host%>'">
<input name="USER" type="text">
<input name="PASS" type="password">
<input type=submit>
</form>
 

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,786
Messages
2,569,626
Members
45,328
Latest member
66Teonna9

Latest Threads

Top