upload file permission

i get error everytime i try upload file with asp.net

error:
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

code:
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs( "\\Images\\" + FileUpload1.FileName);
Label1.Text = "success";
}
else
{
Label1.Text = "fail";
}

i have tryed this threads "http://support.jodohost.com/showthread.php?t=7974" for using medium trust but its not work for me..

i need help...
 
You need phisical path in SaveAs sentence.

Try this:

FileUpload1.SaveAs( Server.MapPath("\\Images\\" + FileUpload1.FileName));
 
You need phisical path in SaveAs sentence.

Try this:

FileUpload1.SaveAs( Server.MapPath("\\Images\\" + FileUpload1.FileName));

i have tried that code.. i using sever h-spare, for server h-spare if i using sever.mappath / Request.PhysicalApplicationPath the path will be deny...

that's why i can't using that code

i don't know what i have to do..
 
Please download the medium trust config file here:
http://support.jodohost.com/showthread.php?t=7974

once you have done that set your asp.net 2 config to use this (from the web.config set mediumtrust.config to the the medium trust, and set trust level to medium, and set override to false)

there are a few mods to this medium trust since it was updated last here, but mostly LINQ, and Email settings, I will work to get it updated in the next week, but it won't have any bearing on your upload issue.

you can test your code in your desktop environment after this
 
Back
Top