Solved

a servlet/jsp question and HTTP_REFERER

Posted on 2006-11-07
13
875 Views
Last Modified: 2013-11-24
i have a jsp authentication form that posts to a servlet.
if the authentication fails(ie bad username) i want to send back message to the calling jsp.

i was going to use HTTP_REFERER and just send the message back to HTTP_REFERER , but i have been doing some reading and it appears that HTTP_REFERER  is not dependable. That some tools like norton will block this

so does any but know this for sure and how do other people handle this. For now i have a myreferer hidden in the jsp, but seems a little kludgy

Thanks for any help
Randy
0
Comment
Question by:paries
  • 6
  • 5
  • 2
13 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17890443
You could use Ajax and thus not only be able to send a message to the caller, but do it without leaving the caller
0
 

Author Comment

by:paries
ID: 17890464
yeah thats ok, but i am having all sorts of wonderful security problems with alot of my customers so ajax is only an option, which means you still have to write for the browsers that will not run ajax.

thanks
0
 
LVL 8

Expert Comment

by:colr__
ID: 17890465
Or you could simply post back to the calling JSP with a url paramater that states that the login failed.
0
 

Author Comment

by:paries
ID: 17890496
correct, but the question is , what is the best way to post back to the calling jsp?
0
 

Author Comment

by:paries
ID: 17890502
how do i know what the calling jsp is?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17890530
You could make clients pass themselves as referer explicitly as one of the post params
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:paries
ID: 17890552
k that i how this post started. That is exactly what i am doing now.
"For now i have a myreferer hidden in the jsp, but seems a little kludgy" I guess i should have said
"For now i have a myreferer as a hidden in the jsp, but seems a little kludgy"
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17890616
Well what i'm suggesting is user interaction. What you're suggesting sounded like hard-coding...
0
 

Author Comment

by:paries
ID: 17890822
ok i am confused
how do i "make clients pass themselves as referer explicitly as one of the post params"
0
 
LVL 8

Expert Comment

by:colr__
ID: 17890877
<input type="hidden" name="referrer" value="thisPage.jsp" />
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17890889
Try doing something like this in the onsubmit handler of the form

function submitForm() {
    document.forms[0].username.value = ...
    document.forms[0].password.value = ...
    document.forms[0].referer.value = document.location;
    return true;
}

..............

<input type="hidden" name="referer" value="" >
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 17890907
Or rather

document.forms[0].referer.value = document.location.href;
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17891794
:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Understanding websocket example in spring 1 56
best (free) software to access postgres db (java) 1 32
eclipse formatting 6 71
Image decoding from Camera 3 72
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now