.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Image Upload Fails- access denied to folder

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :WPF

i am trying to use a fileopen dialog to select an image and copy it to my project folder .

i have used this code to do that.

OpenFileDialog ofd = new OpenFileDialog();
      ofd.Filter = "All Image Files| *.*";
          imgImagePath.Source=new BitmapImage(new Uri(ofd.FileName,UriKind.RelativeOrAbsolute));
          FileStream fs = new FileStream(ofd.FileName,FileMode.Open,FileAccess.Read);
          FileStream copyfs = new FileStream(@"../../Themes/Images", FileMode.CreateNew, FileAccess.Write);

The Error i am gettin is The so and so folder access is denied.

I have check that the folder is not read only. and its in d:

Any suggestions?


View Complete Post

More Related Resource Links

ASP.Net Upload Image to MS Access Database

As you learnt from the previous articles to upload image to the SQL Database in ASP.Net 2.0 and stream that image into the memory to retrieve it from the database and display it on the web page. In this article you will learn how to upload images to the MS Access database in ASP.Net 2.0

First of all create an Access Database and place it in the App_Data folder of ASP.Net web site project. Then create a table "tblImg" with the following fields:

Asp.Net upload file access denied



I have the problem below, if anyone can help me, appreciate it.

Server Error in '/' Application.

Access to the path 'c:\Inetpub\EnewsAttFiles\employ-e-header2.jpg' is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'c:\Inetpub\EnewsAttFiles\employ-e-header2.jpg' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Hig

Access denied to folder in ASP.NET project either though I have granted all users full permissions !



i have made a very simple file upload app, that i want users to be able to upload images to a folder on my server, well localhost for the time being Stick out tongue

here is the simple upload code...

        protected void ButtonRegisterDetails_Click(object sender, EventArgs e) 
            // display properties of the uploaded file 

Folder inside the List shows Access Denied when try to open using Manage Content Structure

Hi All, We are facing this issue in one of our site, when accessing the folder from Manage content structure. Folder is inside a list which uses a folder content type. When we try to open this folder use manage content and structure it throws access denied. any idea how we can check this as we the permissions are properly inherited and all the folders are checked in . Please update what else we can check.   Thanks, Jasjeet SIngh

Access is denied when creating Alert me on a folder level permission is this a known bug?

Hi, A user is getting an Access Denied error when creating an Alert Me on a folder level. The security set to the user is, Read access to the list but without permission to Create an alert, and he has a Contributor access to the folder. The security was perfect, he can't create an alert to a list level, but Alert Me is available on a folder level. When the user clicks on the Alert Me on a specific folder it will bring him to the alert configuration page, BUT, he would get an Access Denied error when hitting the OK(Save) button. Is this a known issue in Item/folder level security? The fact that Sharepoint allows user to see Alert Me function I assume that it should function correctly, but this is not the case. Hope to hear from you guys! TIA!  

IIS 7 & W2K8 - Access to path \\remotewinXP\folder\ is denied. No error on IIS 6 & W2K3 hosting. Any



Appreciate if someone could point to the right answer on how to overcome this error. By clicking the Button3, the ExportedFilePDF.pdf should be copied to the \\presario remote machine. So far, no security issue on the same configuration in IIS6 + W2K3.

  Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
            File.Copy("C:\BackOffice\Export\ExportedFilePDF.pdf", "\\presario\FaxServer\Outbox\ExportedFilePDF.pdf", True)
        Catch ex As Exception
            Response.Write("Error copying file | " & ex.ToString)
        End Try

    End Sub

 The browser will generate this error message when the Button3 is clicked.

Error copying file | System.UnauthorizedAccessException: Access to the path '\\presario\FaxServer\Outbox\ExportedFilePDF.pdf' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) at Test5.Button3_Click(Objec

SharePoint 2010 - Crawl Fails - Access is denied


Please help!!  I have recreated the Search Service Application and when I try to do any type of crawl - I get the following error.  I can not figure out where the problem is.  The event logs indicate the same error as well.  I think it should be pretty straight forward.  I have already disabled the loopBackCheck in the registry.

Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled.

Please help!  Thank you.


Add Web reference in Visual Studio 2008 fails with Access denied error


i am trying to add a wsdl file to a C# project by using Add Web Reference utility but the tool fails with the error access denied to the path .. is denied. quite not sure where to check the params. any help would be appreciated.

Upload transparent PNG image


Hi everybody

I'm creating a website where it must  be able to upload, crop and resize images. This works until I use transparent PNG images. When I upload a transparent PNG, the transparency becomes black. I've searched the whole internet, but found no solution so far. Can someone help me? This is my code. I'm working with MVC 2.

			try {
				HttpPostedFileBase file = Request.Files["image"];
				file.SaveAs(Server.MapPath("/Uploads/" + file.FileName));

				ViewData["ImageLocation"] = "/Uploads/" + file.FileName;
				return View();
			catch (Exception exc) {
				return RedirectToAction("UploadImage");

How to upload image in Mobile Application?


I have requirement to upload the image in mobile Web application using asp.net. For this I have add mobile templates but regarding to image there is no any file upload control. Then I see one article and use the below code:

<mobile:DeviceSpecific ID="DeviceSpecific1" Runat="server">
                <input style="width: 389px; height: 22px" type="file" size="45" runat="server" id="FileUpload1">

Access to report file denied. Another program may be using it.


Migrated from Windows 2000 ASP.NET 1.1 to Windows 2003, ASP.NET 2.0 and had this error. All the forums/MSDN/Blogs says to give Read/Write Access to C:\Windows\Temp folder. Why should we give Full Access to some folder in Production server?? In windows 2000, ASP.NET 2.0 development machine, no files are created when we run crystal reports from aspx pages. Then why in Windows 2003 servers, we need to give rights to temp folder?? It is a simple code


And the code is not storing anything on the disk. Then why should it store the GUID.rpt file in Temp file in Windows 2003 server?? Any alternative is there not to store anything on the disk when Crystal Reports are opened in aspx page??


Access Classes in an aspx page that is in folder in asp.net


I have classes in App_Code:
Connection.cs, ClientData.cs ....

I have a folder Authenticated within it have an aspx page Client.aspx

How do I access the page through Client.aspx ClientData.cs the class, because there is a mistake for me to define the class as I do, please help me!

"Access is denied. Check that the Default Content Access Account has access to this content"


Our search is not working. The crawl log indicates following error: "Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content. (The item was deleted because it was either not found or the crawler was denied access to it.)".


If I check the event viewer, it indicates following error: "Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. [CLIENT: <local machine>]"


My default content access account is another one than this NT AUTHORITY\NETWORK SERVICE account. The content access account password is correct. Apparently this content access account is translated to the NETWORK SERVICE account upon a crawl. And this network service account doesn't has the appropriate rights on database level. How can I fix this?


Access Denied with SPControlMode.New and RunWithElevatedPriviliges


I am trying to add MultipleLookupField to a webpart I am developing. It works fine as long as the user has Add permission on the list it points to: here is the code:

private MultipleLookupField _multiplelookupKeywords = new MultipleLookupField();
protected override void CreateChildControls()
Guid guidSite = SPContext.Current.Site.ID;
Guid guidWeb = SPContext.Current.Web.ID;
    using (SPSite site = new SPSite(guidSite))
        using (SPWeb web = site.OpenWeb(guidWeb))
  SPList listTest;   
  listTest = web.Lists[ListName]; 
  _multiplelookupKeywords.ListId = listTest.ID;
                _multiplelookupKeywords.ControlMode = SPControlMode.New; //Changing this to SPControlMode.Display works fine
                _multiplelookupKeywords.RenderContext = SPContext.GetContext(web);

Access Denied error


I have read several posts where this access denied to path ex.('c:\test' ).  The only way I got this to work was adding <identity impersonate> using my credentials in the web.config file but I don't want to use my credentials all the time.  I have Windows as the authentication mode so why doesn't it work without supplying my credentials?  I tried giving Network Service account write permissions to the folder but that doesn't work either.

FileUpload Access Denied


Hi all.

I have done much research on this and am still stumped.

I have a ASP.NET 2.0 application, running on Windows 2003 Server. IIS 6.0

I am using Windows authentication , and I am not using impersonization, and I set my trust levvel to full.

<authentication mode="Windows"/>

<identity impersonate="false"/>

<trust level="Full

Sharepoint site client access denied


I have an sharepoint application which was working fine.

I encountered a license expired message in sql server enterprise evaluation 2008 version after which i changed the date to 2 months earlier date, I have also changed HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\ConfigurationState to 3 after which sql server started working but the issue is that the clients are unable to access the sharepoint site completely. On providing the url the web site requests for logon information and then access is denied. The same url with the same authentication credentials is accessible from the server and the entire application works fine from the server. 

From the  client the below error page appears.

You are not authorized to view this page

You do not have permission to view this directory or page using the credentials that you supplied.

Please try the following:

  • Contact the Web site administrator if you believe you should be able to view this directory or page.
  • Click the Refresh button to try again with different credentials.

HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend