相对路径产生js文件、html文件。
关键字:Split()、.Replace()、MapPath()。
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace new_app
{
/// <summary>
/// myxml 的摘要说明。
/// </summary>
public class myxml : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
write_file();
}
public void write_file()
{
string filename="file.js";
DateTime dtstr = DateTime.Now;
string fileNameString = MapPath(filename);
Regex r = new Regex(" ");
Regex r2 = new Regex("-");
Regex r3 = new Regex(":");
string[] s = r.Split(dtstr.ToString());
string[] s2 = r2.Split(s[0]);
string[] s3 = r3.Split(s[1]);
string qname=s2[0]+s2[1]+s2[2]+s3[0]+s3[1]+s3[2]+".htm";
string fileNameString2 = MapPath(qname);
string errString = "我的盐城热线!";
string correctString = errString.Replace("热线", "信息港");
Response.Write(correctString);
补充:asp教程,高级应用