evgeny Skrevet 17. oktober 2007 Del Skrevet 17. oktober 2007 Hei. Jeg lager en Web app i CSharp. Kjører vista. Forløbig tester jeg upload funskjonen hvor jeg browser etter en fil som jeg skal uploade til min mappe 'C:\dotNet\filer'. Line 111: if (FileUpload1.HasFile) Line 112: { Line 113: FileUpload1.PostedFile.SaveAs(@"C:\dotNet\filer"); Line 114: Line 115: Alt går fint til den skal lagre filen i 'C:\dotNet\filer' mappa da får jeg denne feilen. Access to the path 'C:\dotNet\filer' is denied. System.UnauthorizedAccessException: Access to the path 'C:\dotNet\filer' is denied. [unauthorizedAccessException: Access to the path 'C:\dotNet\filer' is denied.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +2094723 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) +998 System.IO.FileStream..ctor(String path, FileMode mode) +64 System.Web.HttpPostedFile.SaveAs(String filename) +87 nySak.Button1_Click(Object sender, EventArgs e) in c:\dotNet\su\nySak.aspx.cs:113 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(St ing eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 Jeg har gitt skrive rettigheter til både network service, IUSR_MACHINENAME kontoer i denne mappa så da vet jeg ikke hva mer det kan være. Please hjelp jeg klikker snart :-) Lenke til kommentar
j000rn Skrevet 17. oktober 2007 Del Skrevet 17. oktober 2007 Hvis du bruker windows authentfication og impersonation må du gi tilgang til den windowsbrukeren som browser websiden. For anonyme besøkende blir IUSR_maskinnavn brukt av gamle ASP. ASP.Net bruker ASPNET brukeren. Lenke til kommentar
evgeny Skrevet 17. oktober 2007 Forfatter Del Skrevet 17. oktober 2007 Vet ikke om jeg bruker windows authentfication og impersonation. Hvordan finner jeg ut det? Har bare gitt skriverettigheter til IUSR_maskinnavn og network service på den gjeldende mappa. Har også skrudd av UAC i vista. Lenke til kommentar
j000rn Skrevet 17. oktober 2007 Del Skrevet 17. oktober 2007 (endret) Vet ikke om jeg bruker windows authentfication og impersonation. Hvordan finner jeg ut det? Har bare gitt skriverettigheter til IUSR_maskinnavn og network service på den gjeldende mappa. Har også skrudd av UAC i vista. Windows auth: Settes i IIS. Security. Velg "Integrated security" f.eks... Impersonation (+ Windows auth): settes i web.config <authentification mode="Windows"..> og <identity impersonate="true"/> Jeg anbefaler STERKT å la UAC være på når man programmerer. De som skrur dette av har ikke snøring på hva de driver på med, etter min mening. Dette gjør at du enkelt kan teste løsningene du lager som en vanlig bruker. Ta heller å høyreklikk på ikonet og "Run as administrator" når du skal bruke f.eks. IIS og Management Studio, etc. UAC er en av de geniale nyhetene i Vista, -- SÆRLIG for utviklere!! Endret 17. oktober 2007 av jorn79 Lenke til kommentar
Manfred Skrevet 17. oktober 2007 Del Skrevet 17. oktober 2007 Du må både gi NETWORK SERVICE skrivetilgang og sette mappen til "Write" i properties i IIS (som standard har den bare Read), og da vil IIS uansett nekte deg tilgang. Lenke til kommentar
evgeny Skrevet 18. oktober 2007 Forfatter Del Skrevet 18. oktober 2007 Vet ikke om jeg bruker windows authentfication og impersonation. Hvordan finner jeg ut det? Har bare gitt skriverettigheter til IUSR_maskinnavn og network service på den gjeldende mappa. Har også skrudd av UAC i vista. Windows auth: Settes i IIS. Security. Velg "Integrated security" f.eks... Impersonation (+ Windows auth): settes i web.config <authentification mode="Windows"..> og <identity impersonate="true"/> Jeg anbefaler STERKT å la UAC være på når man programmerer. De som skrur dette av har ikke snøring på hva de driver på med, etter min mening. Dette gjør at du enkelt kan teste løsningene du lager som en vanlig bruker. Ta heller å høyreklikk på ikonet og "Run as administrator" når du skal bruke f.eks. IIS og Management Studio, etc. UAC er en av de geniale nyhetene i Vista, -- SÆRLIG for utviklere!! Nå har jeg satt asp.net impersonation og windows authentication til ENABLED i IIS manager og lagt disse 2 linjene i web.config fila <identity impersonate="true"/> <authentication mode="Windows"/> og fortsatt får jeg access denied. Noen andre forslag? :-) Du må både gi NETWORK SERVICE skrivetilgang og sette mappen til "Write" i properties i IIS (som standard har den bare Read), og da vil IIS uansett nekte deg tilgang. Finner ikke noe sted i IIS manager hvor man gir mapper tilgang. Kan du forklare mer spesifikt hvor det ligger hen? Lenke til kommentar
evgeny Skrevet 18. oktober 2007 Forfatter Del Skrevet 18. oktober 2007 Rettelse. Jeg satt ikke asp.net impersonation til enabled i forrige posten men det har jeg gjort nå og får da denne feilmeldingen når jeg kjører websiden Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message: -- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>IIS 7.0 Detailed Error - 500.0 - Internal Server Error</TITLE> <META http-equiv=Content-Type content="text/html; charset=utf-8"> <STYLE> BODY { FONT-WEIGHT: normal; FONT-SIZE: 0.7em; COLOR: black; FONT-FAMILY: "Verdana" } B { MARGIN-TOP: 0px; FONT-WEIGHT: bold; COLOR: black; FONT-FAMILY: "Verdana" } H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } PRE { FONT-SIZE: 0.9em; FONT-FAMILY: "Lucida Console" } P { margin-top: 5pt } </STYLE> </HEAD> <BODY bgColor="white"> <SPAN> <H1>Server Error in Application "Default Web Site/supportWS"</H1> <HR width="100%" color="silver" SIZE="1"> <H2><I>HTTP Error 500.0 - Internal Server Error</I></H2> </SPAN> <FONT face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif"> <P><B>Description:</B> <b>This application is running in an application pool that uses the Integrated .NET mode. This is the preferred mode for running ASP.NET applications on the current and future version of IIS.<br><br></b><b>In this mode, the application using client impersonation configured with <identity impersonate="true" /> may not behave correctly. Client impersonation is not available in early ASP.NET request processing stages and may lead modules in those stages to execute with process identity instead. You have the following options: </b><h3>1) Disable client impersonation.</h3> If your application design allows it, you can disable client impersonation by setting <identity impersonate="false" /> in your web.config file. This will make your application code execute with the process identity.<BR><BR> <b>NOTE: This option may require permissions on your application's files and data to be changed to allow access to the process identity.</b>\ <h3>2) Disable this error.</h3 >If you do not have any modules executing within the BeginRequest and AuthenticateRequest ASP.NET pipeline stages, or it is acceptable for that code to execute under process identity, you can disable this error by setting <validation validateIntegratedModeConfiguration="false" /> in your application's configuration. Do this only after making sure that the rest of your configuration is compatible with Integrated .NET mode, as thiswill turn off the runtime validation for the application. <h3>3) Move this application to an application pool using the Classic .NET mode (PREFERRED).</h3>You can move the application to an application pool that uses the Classic .NET mode by using the following from a command line window (the window must be running as Administrator) <BR><BR> <b>%systemroot%\system32\inetsrv\APPCMD.EXE set app "Default Web Site/supportWS" /applicationPool:"Classic .NET AppPool"</b><BR><BR> Alternatively, you can use any other application pool on your system that is running in the Classic .NET mode. You can also use the IIS Administration tool to move this application to another application pool.<BR><BR> <b>It is preferred that you move this application to the Classic .NET mode by using option 3 to insure that your application continues to work if you are unsure of or unable to use the first two options.</b> <P><B>Error Code:</B> 0x80070032 <P><B>Notification:</B> BeginRequest <P><B>Module:</B> ConfigurationValidationModule <P><B>Requested URL:</B> http://localhost:80/supportWS/supportWS.asmx <P><B>Physical Path:</B> C:\inetpub\wwwroot\supportWS\supportWS.asmx Lenke til kommentar
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå