• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access denied after file downloading

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm currently working on file uploading and downloading from client site to the server's site. One problem that I'm facing currently is after I downloaded files from the jsp, I received an "Error on page" error. When I double click on the exclaimation icon at the bottom left corner, the message details says that "Access is denied". I managed to download the file to the any location i wish, but after download, i just can't navigate to other page even though i click at the link.
Any suggestion will be highly appreciated... Thank you very much
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We've seen this problem before with file uploading. The problem is that the servlet container doesn't understand the encoding used to upload files and therefore can't pick the session ID from the HTTP header.
The usual solution is to use response.encodeURL to make the session available as part of the url rather than having to look in the header.
Dave
 
Conie Ooi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply, but I'm not so understand about the reply, can you explain more details?
In my jsp, I'm using out.println to print out the file url for user to click and download. The following is my code in jsp:
out.println("<a href=servlet/download.downloadServlet?attachmentId=" +getAttachId() + "&filename="+URLEncoder.encode(getFName())+">" + getFName() + "</a>");

Tried to use response.encodeURL too, but i still have the same error..
String encodedurl = "servlet/download.downloadServlet?attachmentId=" +getAttachId() + "&filename="+getFName());
out.println("<a href="+response.encodeURL(encodedurl)+">"+ getFName() + "</a>");
Anything that i have missed out???
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the problem during the download? I though it would be more likely to show up during a file upload...
 
Conie Ooi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the problem is after the file is downloaded. The file content is ok, it's just I can't visit to the other page anymore except if I refresh the page..
Any idea how to solve?
 
expectation is the root of all heartache - shakespeare. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic