Common namespace locations

Source: Internet
Author: User
Tags servervariables

When writing a class file, you don't want to introduce the namespace unless you need some methods. Well, you cannot figure it out. record it. Multiple records are used.

Note the following to add a project reference system. Web. dll

Use using system. configuration; these require using system. configuration; namespaces

Public void break (string strinfo)
{
System. web. httpcontext. current. response. write ("<SCRIPT> alert (\ '" + strinfo + "\'); history. back (); </SCRIPT> ");
System. Web. httpcontext. Current. response. End ();
}

Userjudge2 = system. Text. encoding. Default. getbytecount (STR );

Stringbuilder sb = new stringbuilder ();

SB. append ("××× )");

 

Response

System. web. httpcontext. current. response. write ("<SCRIPT> alert (\ '" + errinfo + "\'); history. back (); <"+"/SCRIPT> ");

 

Server. mappath

System. Web. httpcontext. Current. server. mappath (
Configurationsettings. deleettings ["ac_dbpath"]);

Session

System. Web. httpcontext. Current. session ["admcheckcode"]

MD5

System. Web. Security. formsauthentication. hashpasswordforstoringinconfigfile (STR, "MD5 ")

Configurationsettings

System. configuration. configurationsettings. receivettings ["mailfrom"];

Servervariables (hot, I found it for half a day.)

System. Collections. Specialized. namevaluecollection servervariables = system. Web. httpcontext. Current. Request. servervariables;
Response. Write (servervariables ["http_referer"]);

Htmlencode

System. Web. httputility. htmlencode (MSG)

 Pageddatasource

Private system. Web. UI. webcontrols. pageddatasource _ objpds;

RegEx Regular Expression

System. Text. regularexpressions RegEx

 

 

Request. currentexecutionfilepath: Obtain the virtual path of the current request.
Streamreader sr = file. opentext (
System. Web. httpcontext. Current. server. mappath ("resource/templet "));

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.