Yes, but that would require that the applet users to enter username and password in the applet itself again, eventhough they are already logged on to the web application, and I would like a solution without this; the user is already logged on to the .aspx page/application.
The .aspx page, which is handling the upload is merely a standalone page, which only process an upload request and nothing more. Something like this...
Code:
public void Page_Load(Object oSender, EventArgs eArg)
{
int uploaded = 0;
this.Response.Clear();
this.Response.BufferOutput = true;
this.Response.ContentType = "text/ascii";
try
{
...
HttpPostedFile file;
foreach(string f in this.Request.Files.AllKeys)
{
try
{
file = this.Request.Files[f];
file.SaveAs(path + ((path.EndsWith(@"\"))? "" : @"\")
+ System.IO.Path.GetFileName(file.FileName));
this.Response.Write(System.IO.Path.GetFileName(file.FileName) + " (uploaded)\n");
uploaded++;
}
catch(Exception e)
{
this.Response.Write("- File upload of '" + f + "' failed. " + e.Message);
}
}
}
catch(Exception e)
{
this.Response.Write("Exception: " + e.Message + "\n");
}
this.Response.Write(uploaded + " files were succesfully uploaded.\n");
this.Response.End();
}
Since it is an applet, the user do not leave the page in which the applet resides. The upload is then another session... unfortunately. I would like it to be the same. All the login stuff is done for the web application but I have been forced to make a Java applet in order to select multiple files for upload, and this solution unfortunately introduce these other authorization problems.
Jacob.