Hi,

Patch Attached.

Please review. (would like to know if there is a better way of doing
it. :-) )

Thanks,
Johnny

Index: ServerDetails.aspx.cs
===================================================================
--- ServerDetails.aspx.cs       (revision 6784)
+++ ServerDetails.aspx.cs       (working copy)
@@ -398,7 +398,35 @@
                        return rm.GetString( key );
                }
 
+
                /// <summary>
+               /// 
+               /// </summary>
+               /// <param name="sender"></param>
+               /// <param name="e"></param>
+               protected void DownloadFile( string url, string fileName )
+               {
+                       string fileurl = url + fileName;
+                       WebClient wc = new WebClient ();
+                       wc.Credentials = web.Credentials;
+
+                       Byte[] fileData = null;
+                       fileData =  wc.DownloadData ( fileurl );
+
+                       Response.Clear();
+                       Response.Cache.SetCacheability( 
HttpCacheability.NoCache );
+                       Response.BufferOutput = false;
+                       Response.AddHeader( 
+                                       "Content-Disposition", 
+                                       String.Format("attachment; 
filename={0}", fileName ) );
+                       Response.ContentType = "text/plain";
+                       Response.AddHeader("Content-Length", 
fileData.Length.ToString() );
+                       Response.OutputStream.Write( fileData , 0, 
fileData.Length );
+
+                       Response.Close();
+               }
+
+               /// <summary>
                /// Event handler that gets called when the ViewReport Button 
is clicked.
                /// </summary>
                /// <param name="sender"></param>
@@ -410,7 +438,10 @@
                        // Send a request to the report/log file handler.
                        // TODO : use the public url of the system we are 
displaying and redirect there .
                        if (reportFileName != null && reportFileName != 
string.Empty )
-                               Response.Redirect ( web.GetServer( ServerID 
).PublicUrl + "/admindata/" +reportFileName );
+                       {
+                              string fileurl = web.GetServer( ServerID 
).PrivateUrl + "/admindata/";
+                              DownloadFile (fileurl, reportFileName);
+                       }
                }
 
                /// <summary>
@@ -435,7 +466,8 @@
                        }
 
                        // Send a request to the log file handler.
-                       Response.Redirect( web.GetServer( ServerID ).PublicUrl 
+ "/admindata/" + logFileName );
+                       string fileurl = web.GetServer( ServerID ).PrivateUrl + 
"/admindata/";
+                       DownloadFile (fileurl, logFileName);
                }
 
                #endregion
_______________________________________________
ifolder-dev mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/ifolder-dev

Reply via email to