SLODUG
Spletno mesto uporabniške skupine slovenskih razvijalcev programskih rešitev

Medium trust način

ocenilo 0 uporabnikov
nerešeno Ta prispevek ima 0 preverjenih odgovorov | 5 odgovorov | 2 sledilcev

bobi objavljeno v 02-06-2009 13:06 | Zabeleženo

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]


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 == allowedExtensionsIdea)
                           {
                               // 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...

 

Vsi odgovori

MihaM V odgovor na 02-06-2009 14:09 | Zabeleženo

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.

Andrej
Microsoft MVP: Client Application Development
ANT Andrej Tozon s.p., Solution development and consulting
http://www.tozon.info | http://www.tozon.info/blog/

bobi V odgovor na 02-09-2009 17:22 | Zabeleženo

Ni bil problem v nalaganju slike, ampak v tem:

 

String savePath2 = System.Environment.CurrentDirectory + @"\Slike_lista\";

bobi V odgovor na 02-19-2009 8:50 | Zabeleženo

 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_";

bobi V odgovor na 03-03-2009 9:45 | Zabeleženo

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 />?

Stran 1 od 1 (6 predmetov) | RSS
© 2004-2008 SLODUG
Powered by Community Server (Commercial Edition), by Telligent Systems