hi everyone,
as i have discussed with you many times. today i am having problem with some exception that comes when i am trying to insert the file into database(pdf file). in local machine it's going well. but when i am trying to run this application on server then it's show some exception ,here is code of mine which i s running well in local machine :-
protected void btnsave_Click(object sender, EventArgs e)
{
if (flUpld.HasFile == false)
{
lblerror.Text = "select a file to upload";
}
else
{
try
{
string filename = flUpld.FileName;
find =Request.ApplicationPath;
flUpld.PostedFile.SaveAs(Server.MapPath(find+"//result//" + filename.Trim()));
string path = find+"//result//" + filename.Trim();
if (ChangeData.InsertResult(ddlcategory.SelectedValue.ToString(), ddlsubcategory.SelectedValue.ToString(),
txttitle.Text, path))
{
txttitle.Text = "";
lblerror.Text = "sucessfully submitted";
}
else
{
lblerror.Text = "try again later ";
}
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
}
and when i am trying to upload this site on server and trying to insert then it show the error
exception :-
System.UnauthorizedAccessException: Access to the path 'D:\INETPUB\VHOSTS\sarkarirozgar.com\httpdocs\result\Andersens_Fairy_Tales_NT.pdf' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at ADMIN_Manage_Results.btnsave_Click(Object sender, EventArgs e) in d:\inetpub\vhosts\sarkarirozgar.com\httpdocs\ADMIN\Manage_Results.aspx.cs:line 70
help me out why it is going on because i have provided all the permission to the folder.. help me out.
my structure of the folder.
ADMIN PANEL
-manageresult.aspx
-manageresult.aspx.cs
result
userpanel
like this means the folder where i m trying to save the pdf file is in root. and the pages are under the admin folder .