Pessoal estou querendo fazer uma aplicação fazer download em uma máquina remota. O lado servidor está funcionando blza (o upload) mas quando a máquina cliente pegas os arquivos no servidor e tenta gravar localmente dá erro de acesso como descrito abaixo!
Access to the path 'C:\FOTOS' 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:\FOTOS' 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 and IIS 7, and the configured application pool identity on IIS 7.5) 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. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 272: byte[] b1 = null;
Line 273: b1 = ls1.DownloadFile(TextBox1.Text);
Line 274: fs1 = new FileStream("C:\\FOTOS", FileMode.Create); // O ERRO È AQUI
Pergunta
fdefod
Pessoal estou querendo fazer uma aplicação fazer download em uma máquina remota. O lado servidor está funcionando blza (o upload) mas quando a máquina cliente pegas os arquivos no servidor e tenta gravar localmente dá erro de acesso como descrito abaixo!
Access to the path 'C:\FOTOS' 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:\FOTOS' 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 and IIS 7, and the configured application pool identity on IIS 7.5) 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. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 272: byte[] b1 = null;
Line 273: b1 = ls1.DownloadFile(TextBox1.Text);
Line 274: fs1 = new FileStream("C:\\FOTOS", FileMode.Create); // O ERRO È AQUI
Line 275: fs1.Write(b1, 0, b1.Length);
Line 276: fs1.Close();
Source File: C:\Users\DG\Desktop\ControleServidores\ControleServidores\Default.aspx.cs Line: 274
alguém sabe dizer como resolver?
Link para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.