Document directory
1. Request. applicationpath-> current application directory
2. Request. filepath-> corresponds to the virtual directory of IIS
3. Request. Path-> the virtual path of the current request
4. Request. mappath (string URL)-> map the URL to a virtual directory on IIS
5. server. mappath (string URL)-> map the URL to the physical path on the server.
Physical path of the website on the server disk: httpruntime. appdomainapppathVirtual program path: httpruntime. appdomainappvi
.
Later, I thought of xml configuration. The problem could be solved in both the flexibility of table body presentation and the data provision class.
All these three functions use the POST method to pass the values. After understanding this, it is very convenient to directly splice SQL to complete these three functions, which is very simple.
# Add region? Garó ,? Modify T ?,? Delete? Except y case "edit": String tablename = context. request. querystring ["tablename"]. tostring (); string id
ArticleDirectory
1. Request. applicationpath-> current application directory
2. Request. filepath-> corresponds to the virtual directory of IIS
3. Request. Path-> the virtual path of the current request
4. Request. mappath (string URL)-> map the URL to a virtual directory on IIS
5. server. mappath (string URL)-> map the URL to the physical path on the server.
Physical path of the website on the server disk: httpruntime. appdomainapppathVirtualProgramPath: httpruntime.
Get the full absolute path to the projectString path = System.AppDomain.CurrentDomain.BaseDirectory.ToString ();String path = Server.MapPath ("."); /This "." Can be replaced by other folder names in the project fileOutput ASP. NET Web site pathprivate void responsehtml (){System.Text.StringBuilder sb = new System.Text.StringBuilder ();Sb. Append (String. Format ("Current time: {0}", Server.HTMLEncode (DateT
I. Appending and deleting strings using the StringBuilder class1. Creating an object of the StringBuilder classStringBuilder sb=new StringBuilder ("Initial string value");2.Append () Method stitching stringsSb. Append ("hehe");The result is: initial string value hehe3. Insert a string at the specified location using the Insert () methodSb. Insert (position, string);Sb. Insert (2, "on");The result is: Initia
Getcachekey (){Const string Keyformat = "Pager-sc:{0}-fc:{1}-wc:{2}-gc:{3}-sc:{4}";return string. Format (Keyformat, Selectclause, FromClause, Whereclause, Groupclause, Sortclause);} /**////SQL statement that generates the total number of query recordspublic string Generatecountsql (){StringBuilder sb = new StringBuilder (); Sb. AppendFormat ("from {0}", FromClause);if (Whereclause.length > 0)
method to upload the file: // ///uploading local files to the specified server (HttpWebRequest method)/// /// files uploaded to the server /// local file to upload (full path) /// name of file after uploading /// Upload progress bar /// successfully returned 1, failed to return 0 Private intUpload_request (stringAddressstringFilenamepath,stringSavename, ProgressBar ProgressBar) { intReturnValue =0; //the file to uploadFileStream fs =N
If your computer is added to an AD domain, you can obtain information about all computers and users in the domain.
The Assembly used. Net Framework 4 is required.
Add Assembly reference System. DirectoryServices. AccountManagement
Obtain the AD domain name. If the domain name is not added to the AD domain, only the computer name can be obtained.
If no domain is added, subsequent operations such as obtaining Domain Users and computers cannot be performed. An exception is thrown when the domain c
Use oledb in. Net to export dataset data to an Excel file
Function Description:
// DT is the data source (data table)
// Excelfilename is the excle file to be exported.
// Modelfile is a template file, which is consistent with the table in the data source. Otherwise, the Data fails to be exported.
// In the modelfile file, you must have a table consistent with DT. tablename and the fields must be consistent.
// Note: If modelfile is not used, you can use a blank Excel file. However, you need to
[Transfer]C #Use httpwebrequest in winform to upload files and display the progress/// /// Upload a local file to the specified server (httpwebrequest method)
/// /// /// /// /// /// Private int upload_request (string address, string filenamepath, string savename, progressbar)
{
Int returnvalue = 0; // file to be uploaded
Filestream FS = new filestream (filenamepath, filemode. Open, fileaccess. Read );
Binaryreader r = new binaryreader (FS); // Timestamp
String strboundary = "----------" + datet
PUBLIC = 0x00000001;public static final int PRIVATE = 0x00000002;public static final int PROTECTED = 0x00000004;public static final int STATIC = 0x00000008;public static final int FINAL = 0x00000010;public static final int SYNCHRONIZED = 0x00000020;public static final int VOLATILE = 0x00000040;public static final int TRANSIENT = 0x00000080;public static final int NATIVE = 0x00000100;public static final int INTERFACE = 0x00000200;public static final int ABSTRACT = 0x00000400;public static final
Convert DataSet to json, and DataSet to json/// /// Convert dataset data to json format/// /// /// Public static string GetJsonByDataset (DataSet ds){If (ds = null | ds. Tables. Count {// If the queried data is null, mark OK: falseReturn "{\" OK \ ": false }";}StringBuilder sb = new StringBuilder ();Sb. Append ("{\" OK \ ": true ,");Foreach (DataTable dt in ds. Tables){
Json is a common ajax data type and is often used. But what if a line break appears in the field? It is obviously not suitable to remove it. Some fields already have line breaks. How can I remove them? I have tested the processing of json classes and have not found any. Unexpectedly, the final processing is indeed so simple: json is often used as a common data type in ajax. But what if a line break appears in the field? It is obviously not suitable to remove it. Some fields already have line bre
, return to 200,yes, pass!11, check this request, see the right inspectors at a glance Ah!12, well, do so much work, what do you do, directly on the code line? All right, come on!We'll pack HttpWebRequest's header first.StringBuilder SB =NewStringBuilder (); sb. Appendline (""); sb. Appendline (""); sb. Appendline ("")
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.