Relative path produces JS file, HTML file.

Source: Internet
Author: User
Tags datetime relative split
Js|js

Keywords: 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>
Summary description of the myxml.
</summary>
public class Myxml:System.Web.UI.Page
{

private void Page_Load (object sender, System.EventArgs e)
{
Place user code here to initialize page

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 = "My Yancheng hotline!" ";
String correctstring = Errstring.replace ("hotline", "Port");
Response.Write (correctstring);
String mydoc= "document.write (\" <a href=\ "http://www.ycinfo.com\" target=\ "_blank\" > Yancheng port </a><br >\ ");";
String mydoc2= "<a href=\" http://www.ycinfo.com\ "target=\" _blank\ "> Yancheng port" + "</a>";
StreamWriter sr = File.createtext (file_name);
StreamWriter sr = File.createtext (filenamestring);
StreamWriter SR2 = File.createtext (fileNameString2);
Sr. WriteLine (MyDoc);
SR2. WriteLine (MYDOC2);
Sr. Close ();
SR2. Close ();
}
Code generated #region the Web forms Designer
Override protected void OnInit (EventArgs e)
{
//
CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
Base. OnInit (e);
}

<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
}
}




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.