asp.net file upload not working

I have an asp.net website I created in VS 2010.  One of the pages is a file upload, when I run it on my local machine it can upload documents up to the server just fine.  When I publish it to that server and I try to upload a document it gives me a generic

ERROR: Logon failure: unknown user name or bad password

I have given the folder I am trying to upload to access by Everyone and it still doesn't work.  Any ideas?
martyuniAsked:
Who is Participating?
 
drypzCommented:
FileUpload1.SaveAs( Server.MapPath(".")  + " \job_uploads$\" & FileUpload1.FileName)
0
 
martyuniAuthor Commented:
Tried as many of the things that i could in there and still getting the error.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
nmarunCommented:
You might then want to share some code and experts here will have a look at it.
0
 
martyuniAuthor Commented:
<table>
             <tr>
                <td class="style1">Job PDF:</td>
                <td><asp:FileUpload ID="FileUpload1" runat="server" /></td>
            </tr>
             <tr>
                <td colspan="2" class="style2"><asp:Label ID="Label1" runat="server"></asp:Label>
                 <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
                    </asp:ToolkitScriptManager></td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="Button1" runat="server" Text="Button" /></td>
            </tr>
        </table>

Code behind:

 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("\\myServer\job_uploads$\" & FileUpload1.FileName)

                Response.Redirect("default.aspx")
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            Label1.Text = "You have not specified a file."
        End If
    End Sub


Page loads, browse to file and get: ERROR: Logon failure: unknown user name or bad password
0
 
masterpassCommented:
make sure you have given access in folder "job_upload" to the ASP.NET, NETWORK and NETWORK SERVICE accounts ..

If still your problem persists, add impersonation to true

<system.web>
<identity impersonate="true" userName="mydomain\myusername"
password="mypassword" />
0
 
martyuniAuthor Commented:
I have all 3 of those accounts with access to that folder.  Still didn't work.  Added the impersonate and tried multiple accounts including a domain admin account and it still didn't work.  

Still unsure why it works on my local machine to that share but once it gets on the iis box it stops working.
0
 
masterpassCommented:
Is the share folder "job_uploads" in the same server or different server ?
0
 
drypzCommented:
Hi! You may try this one.

FileUpload1.SaveAs( Server.MapPath(".")  + \job_uploads$\" & FileUpload1.FileName)
0
 
martyuniAuthor Commented:
Masterpass - Yes the directory is on the same IIS server as the site

drypz - I will try this when I go back to work tomorrow and let you know, thanks for the help.

0
 
martyuniAuthor Commented:
Thank you very much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.