1#regionSave File
2 PublicvoidSaveFile (StringBuilder strhtml)
3{
4stringTpxxid = request.querystring["Fbwzid"];
5Try
6{
7Model.tp_tpxx mtpxx = Ctpxx.getmodel (TPXXID);
8stringf = System.Configuration.ConfigurationManager.AppSettings
9
Ten["Savefilepath"] +"files\\"+
One
Asystem.configuration.configurationmanager.appsettings["Syscode"]; Addresses configured in the Web configuration file
-//Save Address
-stringFilePath = f +"\ \ website publishing \ \"+string. Format ("{0:YYYY-MM-DD}",
the
-DateTime.Now) +"\\"+ Tpxxid +"\\"+ MTPXX.TPBT +". html";
-
-
+if(! Directory.Exists (Path.getdirectoryname (FilePath)))
-{
+ //Create Path
ADirectory.CreateDirectory (Path.getdirectoryname (FilePath));
at}
-
-//Create HTML file, write HTML, full path with extension
-File.delete (FilePath);
-File.appendalltext (FilePath, strhtml.tostring (), encoding.default);
-
inClientscript.registerclientscriptblock (GetType (),"Script","<script
-
toType='Text/javascript'Defer>alert ('Publish successfully! '); newcommon.windowclose
+
-();</script>");
the
*}
$Catch(Exception ex)
Panax Notoginseng{
-
theThrow;
+}
A}
the#endregion
C # Saves a piece of HTML code as an. html file