Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems Creating a file
Message
From
13/01/2011 10:45:19
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Problems Creating a file
Miscellaneous
Thread ID:
01496043
Message ID:
01496043
Views:
113
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?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Next
Reply
Map
View

Click here to load this message in the networking platform