Hosting ima nastavljen ta tip in me zanima v čem je programska koda drugačna od navadne, kaj je treba pazit... ker ne vem kako popravit kodo, ki ji javlja napako:
------------------------------------------
Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Source Error: [No relevant source lines]
[No relevant source lines]
Source File: App_Web_ayhftvmd.2.cs Line: 0
-----------------------------------------------------------------
Gre pa za upload datoteke na strežnik ter zapis v bazo...
String fileExtension = System.IO.Path.GetExtension(Slika_upload.FileName).ToLower(); String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".bmp" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions) { // Get a reference to PostedFile object HttpPostedFile myFile = Slika_upload.PostedFile; // Get size of uploaded file int nFileLen = myFile.ContentLength; // make sure the size of the file is > 0 if (nFileLen > 0) { ResizeFromStream(savePath2, 640, myFile.InputStream); } // Slika_upload.SaveAs(savePath2); }
,,,,,, ter še eno funkcijo za resize...
A tale odstavek kaj pomaga?
FileIOPermission is restricted. This means you can only access files in your application's virtual directory hierarchy. Your application is granted Read, Write, Append, and PathDiscovery permissions for your application's virtual directory hierarchy.
Miha Markic RighHand .net consulting and software development
V glavnem ti ponudniki spletnega prostora preko takih ali drugačnih orodij omogočajo konfiguriranje pravic dostopa (read/write) do določenih imenikov v svojem aplikacijskem prostoru. Le orodje je treba poiskat, kar pa je pri nekaterih ponudnikih že avantura.
AndrejMicrosoft MVP: Client Application DevelopmentANT Andrej Tozon s.p., Solution development and consultinghttp://www.tozon.info | http://www.tozon.info/blog/
Ni bil problem v nalaganju slike, ampak v tem:
String savePath2 = System.Environment.CurrentDirectory + @"\Slike_lista\";
Sedaj sem nastavil string za shranjevanje: String savePath2 = @"Slike_lista\Slike_lista_"; pa mi stvar ne dela...
A je še kj podobnega kot: System.Environment.CurrentDirectory + @"\Slike_lista\Slike_lista_";
Mi lahko kdo pove, kako bi naredil pri vnosu teksta v bazo, da bi dal zraven tudi <br />, da imam malo urejen tekst. Dobim napako če vnesem <br />
A potentially dangerous Request.Form value was detected from the client (ctl00$cphVsebina$Vsebina_t="test <br />"). Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$cphVsebina$Vsebina_t="test <br />"). A bi dal kako drugo označbo noter, pa jo potem pri branju spremenil v <br />?