ASP.NET Collection

zhaozj2021-02-16  59

1.ASP.NET no longer supports the function and defined variables in the way; but can still use the Include File to include file names .aspx, content for HTML.

Workaround: Use <% @ import namespace = "namespace"> to call ?? The compiled DLL compiled DLL should be placed in the BIN directory; ?? Define the file global.asax and use it internally < % @ import namespace = "namespace"> ?? to reference classes

?? In the ASPX file, you must use the way in the way; ?? ASPX still supports the original client script, such as JavaScript; ?? ASPX can coexist with ASP to a site? 2.ado.net ?? Each data connection Corresponding to its corresponding components? • DataSet can return to DataTable or return to DataRow ??? DataTable is similar to a table ??? ROW is a line ??? rows [] [] is the value of a specific cell 3. Cookie ?? cookies more icon? HTTPCOOKIE ("cookiename") cookie name ??? cookie.values.add ("Website", "www.chinapt.com"); add a child ??? The corresponding value is www.chinapt.com ?? Cookie.Values ​​("Website") -> Cookie value

4.Aaspx? A ASPX file corresponds to a .cs file, code can be packaged in .cs file ?? One CS (ASPX) file can reference multiple DLL ?? An ASPX file can also reference multi-structure ASPX files (

) ?? <% @ Import ????? Namespace = "system.data" ??%> <% @ register tagprefix = "jav" ???????????? Tagname = "Search" SRC = "t4.ascx" ????????????????%>

DLL ASPX DLL | ___________________ | | ASPX <------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------> CS (<% @ page language = "c #" debug = "true" ??????????? src = "t2.cs" autoeventwireup = "false" ??????????? inherits = "TWEBA.WEBFORM1"%>) 5. Command line

C: / csharp> CSC / T: library sqldata.cs C: / csharp> CSC / T: library /r: Sqldata.dll datetime.cs6.request string string strings ("querystringname") 7. Use the Request, Response of the Page class in the custom class, using httpcontext.current.response.write httpContext.current.Request, for example:

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;

Edit, / Winnt / Microsoft.Net / Framework / V1.1.4322 / config / machine.config file, set the value of the username in the ProcessModel section to System, and finally restart.

Namespace TRESPONSE {///

/// A reference class / / /

Public class cresponse {public string myname = "TRESPONSE"; public string info = httpContext.current.Request.QueryString.get ("code");

Public void printinfo () {httpContext.current.response.write ("EEWQEWQEWQ Ni Dixin);

//System.Web.httpContext.current.response ("ddddddd ");}}} 8.ASP and ASP.NET can share cookie; ASP: (Write cookie) DIM CookieValue Response.Cookies (" AspCookie ") =" UsernameLoged "Response.Cookies (" AspCookie "). Expires = Date 1 cookieValue = Request.cookies (" AspCookie ") Response.Write (" cookie: " cookieValue) Asp.net (read cookie) String strV = Request. Cookies ["aspcookie"]. Value; response.write ("ASPCookies" STRV); if the ASP writes in the cookie contains Chinese [Remember to introduce System.Text] string strirc = request.cookies ["aspcookie"]. Value ; System.Text.Encoding theEncoding = System.Text.Encoding.GetEncoding ( "gb2312"); String decodeValue = HttpUtility.UrlDecode (strV, theEncoding); Response.Write ( "AspCookies:" decodeValue); ===== ===================================================== ASP.NET (Write cookie String STRV = "www.chinapt.com"; // If there is in Chinese, the following statement is required //system.text.Ext.Encoding.Getencoding ("GB2312"); // String cookievalue = httputility. Urlencode (strv, theencoding); httpcookie Tcookie = New httpcookie ("ASPNETCOOKIE"); //tcookie.values.add ("Tcookie"; Tcookie.Values.Add ("Tcookie", STRV); Response.AppendCookie (Tcookie); ASP: (Read Cookie) Response.write ("ASPNETCOOKIE") ("Tcookie"))

9.OleDbConnection string myConnectionStr = "Provider = SQLOLEDB; Data Source = localhost; Initial Catalog = pratice; User Id = accession number; Password = password;"; 10.SqlConnection "Data Source = Bender / NETSDK; Initial" & _ "Catalog = Contacts; User ID = SA "11.Gbt2big5 idea (http). Look at the table. Convert HTTP input word stream to str [encoding e = encoding.getencoding (936); string str = E.getstring Buffer, offset, count;] Replace the corresponding character. Convert the string to byte stream [E = Encoding.getencoding (System.Web.httpContext.crent.response.charset); _sink.write (E.GETBYTES str), 0, e.GetByteCount (str));] 12.Page_Load method:. isPostBack == true page reload 13 mode = "SQLServer" stateConnectionString = "tcpip = 192.168.127.100: 42424" sqlConnectionString = "data source = 192.168.127.100; user id = admSession; password = adm85597214 "14 Asp.net Xml System.Xml.XmlDocument t = new System.Xml.XmlDocument (); String xmlFilePath =" F: // Web_Program // ChinaPTNet2003 // pubXml / /Chinaptxml.xml "; // String XMLFilePath =" f: // Web_Program // ChinaPTNet2003 // ChinaPTXml.xml "; .Load (xmlFilePath); MessageBox.Show (t.SelectSingleNode (" // Prod46Class ") ChildNodes.Count.ToString ().); MessageBox.Show (t.SelectSingleNode (" // Prod46Class ") .Childnodes.Item (0) .innertext); 15. // Using ASP.NET server control and client script //