Saving to server not working…
Please advice on a solution. This example is provided to save to server in API documentation
flexmonster.save('myreport.xml', 'server', '', 'http://yourserver.com/yourscript.php');
We are attempting:
flexmonster.save('myreport.xml', 'server', '', 'http://ourserver:54422/savereport.aspx');
and flexmonster reports “error! can not save file”. The aspx page attempts to save the incoming HTTP post to a local file and has been tested. When running in a debug environment we can set a breakpoint and confirm
http://ourserver:54422/savereport.aspx never gets called.
Probably you have a security issue. Please check if CORS is enabled on your server.
I recommend you to use a tool like (Fiddle) to server’s response.
Thank you! It turned out to be CORS and another setting I had to change to allow ASP.NET to accept the request format. For other .NET developers I’ll share the web.conf changes I had to set in order to enable this. Now I have to figure out how to decompress the GZIP string
<compilation debug=”true” targetFramework=”4.0″/>
<!– requires because the Microsoft’s request objects don’t play friendly http post with header sequences they don’t reconize –>
<!– validateRequest=”false” also added for this reason –>
<pages validateRequest=”false” controlRenderingCompatibilityVersion=”3.5″ clientIDMode=”AutoID”/>
<!– this enables CORS –>
<add name=”Access-Control-Allow-Origin” value=”*” />
Thank you very much for sharing web.conf for other .NET developers.
Please let us know if you need any further assistance.
Thank you ira!
Also posting the C# ASP.NET source to handle the capture. I took this approach because I’m embedding in a WebForms project, but I hope someone finds this useful.
public partial class CaptureDoc : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
int lineCount = 0;
StringBuilder sb = new StringBuilder();
using (StreamReader sr = new StreamReader(Request.InputStream))
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
string xml = sb.ToString();
string dxml = Server.UrlDecode(xml);
// remove unwanted name-value pairs
dxml = dxml.Replace(“name=myreport.xml&report=”, “”);
dxml = dxml.Replace(“&type=xml”,””);
// write report to hard drive
Response.Write(“<response><status>Success</status><message>Wrote ” + lineCount.ToString() + ” lines</message></response>”);
catch (Exception exc)
Response.Write(“</response><status>Fail</status><exception>” + exc.Message.ToString() + “</exception></response>”);
Thank you so much for posting the solution. We really appreciate this and are happy that you are contributing to the knowledge around our component.