*
The moose likes JSP and the fly likes encodeURL not working :-( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "encodeURL not working :-(" Watch "encodeURL not working :-(" New topic
Author

encodeURL not working :-(

Pat Wallwork
Ranch Hand

Joined: Sep 23, 2001
Posts: 72
Hi,
I am using encodeURL and encodeRedirectURL on all links on my app. If I enable cookies on my browser nothing is appended to my URL's and I can navigate throughtout my site no problem.
Using Netscape 6.2, if I disable cookies the sessionID is appended to the URL but I get this following error:
You don't have permission to access /processLogin.jsp;jsessionid=dhn1f9rz91 on this server.
I have tried using both relative and absolute URL's, and still get this. Is this likely a problem with the server? (It's Apache and Tomcat 3.2) This is very frustrating as I want to allow users that may have cookies disables to still be able to navigate the site.
Any help, tips, suggestions is really welcome!
Pat
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040


You don't have permission to access /processLogin.jsp;jsessionid=dhn1f9rz91 on this server

Seems to me that your application is returning an error
by validating the session and since it may think its
expired. Try redirecting the users to the Login page
with a null sessionId.
My $0.02....
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Pat Wallwork
Ranch Hand

Joined: Sep 23, 2001
Posts: 72
I appreciate your reply satya, but I'm not sure if that helps since it works exactly the way it's supposed to when cookies are enabled on a browser. The only time I get this error is when cookies are disabled and the sessionID is appended to the URL. I don't know anything about servers so I'm wondering if this is possibly a problem in the server enviroment, and not something I have done wrong programmatically.
Developing the site using Tomcat as a standalone on my own computer everything worked fine...including navigating the site with cookies disabled. The sessionID was appended to the URL and I never encountered any errors. This only began when I uploaded the site to the live server.
If anyone else has ever had this happen, or has any suggestions I would really appreciate it. This has me terribly stumped :-(
Pat
Pat Wallwork
Ranch Hand

Joined: Sep 23, 2001
Posts: 72
It's all ok now. Apparently it was a configuration problem with Apache. The sysAdmin fixed it but wasn't clear on what exactly was happening.
Pat
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
I have a similar problem but with a slight variation.
When I disable cookies, the session ID is appended to the URL wherever I use response.encodeURL()
So far so good, but what do I do when I want to append my own parameters to the URL?
If I do it first, for instance:
<A href="<%=response.encodeURL("article.jsp?article_id=" + intID)%>"
I end up with this HTML:
<A href="article.jsp?article_id=5?jsessionid=1241234"

AND if after:
<A href=<%=(response.encodeURL("article.jsp") + "?article_id=" + intID) %>
I get a similar error. If I code it without the "?" then of course it doesn't work when a user has cookies ENabled.
So what do I have to do? Write a function to check the result of encodeURL to find out if I use a "?" or a "+" ?
thanks
Adam


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Pat Wallwork
Ranch Hand

Joined: Sep 23, 2001
Posts: 72
Hi Adam,
I have a couple of pages that do that as well and they work fine. I went back and had a look and noticed that I put the URL and the parameters together in a string first, then I used encodeURL like this:
String originalURL = "<a href=\"./members.jsp?page=" + i + "\">";
String encodedURL = response.encodeURL(originalURL);
Any of my links that have parameters are done like this. Try it this way and see if that fixes the problem.
Pat
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
Are you sure you tested that with cookies disabled? This is exactly what isn't working for me (with Allaire Jrun - which server are you using?)
Adam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: encodeURL not working :-(
 
Similar Threads
encodeURL() not working ??
URL rewriting not working
session and cookies
URGENT ! user privelidges getting swapped when opening 2 sessions in the same machine
Session Tracking with Url Rewriting