RE: Create a file on the server from an aspx
From: Vincent (anonymous_at_discussions.microsoft.com)
Date: 02/26/04
- Next message: surya: "Cannot add a new code group under localintranet_zone programmatically"
- Previous message: surya: "Re: How to determine what permissions are required for an assembly"
- In reply to: BitmapWriter: "Create a file on the server from an aspx"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 26 Feb 2004 03:36:06 -0800
Merci pour la réponse (ce n'est plus la peine) j'ai résolu le problème de la façon suivante:
1/ Spécifier un chemin de fichier complet sur le serveur
2/ Donner les droits d'écriture et de modification (depuis l'explorateur).
Le symptôme "ExternalException (0x80004005): Une erreur générique s'est produite dans GDI+.]"
n'est pas très explicite, mais il s'agissait bien d'un problème de sécurité (et non pas une erreur dans le GDI+)
En testant un truc du genre :
using (StreamWriter sw = new StreamWriter(@"C:\Inetpub\wwwroot\WebApplication1\TestFile.txt"))
{
// Add some text to the file.
sw.Write("This is the ");
sw.WriteLine("header for the file.");
sw.WriteLine("-------------------");
// Arbitrary objects can also be written to the file.
sw.Write("The date is: ");
sw.WriteLine(DateTime.Now);
}
On obtient une erreur beaucoup plus explicite quand on n'a pas les droit d'écriture.
- Next message: surya: "Cannot add a new code group under localintranet_zone programmatically"
- Previous message: surya: "Re: How to determine what permissions are required for an assembly"
- In reply to: BitmapWriter: "Create a file on the server from an aspx"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]