[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

Error trying to upload file with asp:FileUpload

Asked by Alan_Mc in Programming for ASP.NET, Microsoft Visual Basic.Net

Tags: ASP.NET, Access to the path ... is denied.

Hiya,

In my web, there's an option to upload images to the server. If I want to just upload a file that doesn't exists, it works fine, I can do it. But if I try to upload a file with the same name as one that already exist in the server, I get the error:

Access to the path ...  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.

Now, if I go to IIS and browse to this particular folder (under "Web Sites->Library->Images"), right click on properties and I have checked "Read" and "Write" options.

If I go to the Explorer and right clicki on those images none of them have the "Read-only" property set.

It seems like I should have access to overwrite those images. And since I can upload images that do not exist already in the server, I imagine I have access to that as well.

Can anyone provide some help her eplease?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
<div id="uploadForm">
                    Select file to upload:
                    <asp:FileUpload ID="FileUpload1" runat="server"></asp:FileUpload>
                    <asp:Button ID="UploadButton" Text="Upload asset" OnClick="UploadButton_Click" runat="server">
                    </asp:Button>
                    <asp:Label ID="Warning" runat="server" Style="font-weight: bold; margin-left: 15px;
                        font-style: italic"></asp:Label>
                    <asp:Label ID="Size" runat="server" Style="color: red; font-style: italic"></asp:Label>
                    <asp:Label ID="UploadStatusLabel" runat="server"> 
                    </asp:Label>
                    <asp:Label ID="ErrorLabel" runat="server" Style="clear: both; display: block; font-weight: normal;
                        float: none; visibility: visible; color: red; font-style: italic; position: static;
                        height: 5px; font-variant: normal"> 
                    </asp:Label>
                </div>
 
 
 
Protected Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UploadButton.Click
.....
        If (FileUpload1.HasFile) Then
            Dim filesize As Integer = FileUpload1.PostedFile.ContentLength / 1024
            If filesize > FILE_SIZE_LIMIT Then
                Size.Text = "File too big"
            Else
Dim savePath As String = Server.MapPath(imageName)
FileUpload1.SaveAs(savePath)
                UploadStatusLabel.Text = "Your file was saved as " & fileName
           End If
        Else
            UploadStatusLabel.Text = "You did not specify a file to upload."
        End If
    End Sub
 
Related Solutions
Keywords: Error trying to upload file with asp:File…
 
Loading Advertisement...
 
[+][-]08/27/08 09:29 AM, ID: 22326663Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, Microsoft Visual Basic.Net
Tags: ASP.NET, Access to the path ... is denied.
Sign Up Now!
Solution Provided By: Chirag1211
Participating Experts: 2
Solution Grade: A
 
[+][-]08/27/08 09:30 AM, ID: 22326674Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/28/08 12:57 AM, ID: 22332393Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/01/08 02:02 AM, ID: 22358484Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/08/08 07:42 PM, ID: 22423932Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/25/08 04:38 PM, ID: 22575044Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/25/08 11:28 PM, ID: 22577038Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628