Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems Creating a file
Message
De
13/01/2011 10:51:12
 
 
À
13/01/2011 10:45:19
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01496043
Message ID:
01496044
Vues:
46
>Hi,
>
>I use this code to create a PDF file in a folder:
>
>
                    IASSettings oAppSettings = new IASSettings();
>
>                    string URL = oAppSettings.ReportServerURL + "?/SIAS Reports/Receipt&rs:Command=Render&rs:Format=PDF&rc:Parameters=false&ReceiptNumber=" + this.oReceipt.Entity.ReceiptNumber;
>
>                    System.Net.HttpWebRequest Req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(URL);
>                    Req.Credentials = System.Net.CredentialCache.DefaultCredentials;
>                    Req.Method = "GET";
>
>                    //Specify the path for saving.
>
>                    string path = oAppSettings.ReceiptFolder + this.oReceipt.Entity.ReceiptNumber + @".pdf";
>
>                    System.Net.WebResponse objResponse = Req.GetResponse();
>                    System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
>                    System.IO.Stream stream = objResponse.GetResponseStream();
>                    byte[] buf = new byte[1024];
>                    int len = stream.Read(buf, 0, 1024);
>                    while (len > 0)
>                    {
>                        fs.Write(buf, 0, len);
>                        len = stream.Read(buf, 0, 1024);
>                    }
>                    stream.Close();
>                    fs.Close();
>
>It works fine on my development machine, but gives an error on the client's:
>
>The remote server returned an error: (403) Forbidden.
>
>Stack Trace:
>[WebException: The remote server returned an error: (403) Forbidden.]
>System.Net.HttpWebRequest.GetResponse() +1126
>
>I guess this is due to the file not being able to be created, but I've given "Everyone" complete control in the folder where the file is to be created.
>
>I'm going to verify the folder that it is using is the correct folder, but is there something else that I should try?

Since the error is on the HttpWebRequest.GetResponse() it sounds as if the error is in retrieving the data rather than writing it ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform