9cbs. Network bug
1. Do not copy the ASPX file directly in the vs, because the two files use the same class file, if you want to copy, you should make an empty file, then copy the page and code
2, when the project is completed, if you want to get a clean, only required items, you can use the method of copying the project, pay attention, the documentation containing the project will be compiled and copied, and the document is not included. Will be copied, before copying, you need to create a target empty site, and the method of copying should be selected.
3. The generation method of each file in VS.NET has three kinds of compilation, content, embedding, for the CS file, the method of generating the method should be compiled, for the ASPX file, should be content, resources like wanting to embed DLL Such as BMP images, ICO images, strings, etc., should be embedded
Other files, all set to content
4. DataReader can solve, please do not use DataSet
5. Test the paging of the control, especially when DataGird, try to use custom paging, then write a paging method, do not use DataGrid's automatic paging function, automatic paging performance is not good
6. Sometimes, a web project is defined, in the definition, it defines its URL, such as
http: // localhost: 8001 /, but the URL of the project may change, it is http: // localhost: 8009, this time, open the project directly, you may not succeed, you can find the file folder where the project source file is located, use Notepad opens the suffix for .webinfo file, modify the URL point to point
7. In VS.NET, add a form, inevitably add the corresponding CS class file, sometimes, I hope to write code directly in the classic form of <%%> in the ASPX file. At this time, don't delete it directly. CS file, you should first display all files, then open the corresponding ASPX page, then delete the CS file after the <% @ PAGE%> command in the header, then delete the CS file
8.CS1607: AssemblyGeneration - ReferenceDassembly'AssemblyName'isalocalized Handling Processing
The reason is because an attribute in Assembly.cs: [Assembly: AssemblyCultureAttribute ("T)
] Using incorrect values, the right way is to change it to the default value This article is:
Http://weblogs.asp.net/jgaylord/archive/2003/08/22/25003.aspx
9. Write a way to write a Windows event log with ASP.NET
Many people asked in the 9CBS and MS newsgroups, I have also asked, but no fruit, the following method is to ponder it.)
a, open the registry: HK_L_M / System / CurrentControlSet / Services / EventLog / Application Establish an item
The name is the name of EventSource (this step, you can do it in the installation step when you do the project installation file, you don't have to manually operate)
B. In the code, use EventLog.WriteEntry to write the log.
The reason is that there is no permission to establish an event source, but there is permission to read and write the event log.
10, exclude and include items: For files that do not want to include in the final version, you should exclude, the excluded file will not participate in compilation and project replication, if you contain a folder, you will contain all the following levels
11. By default, the ASPX does not allow the POST to contain the content of HTML, add ValidateRequest = "false" in the Page instruction.
6, want to quote the controls of others, you can copy the DLL into the Bin folder, then click Add Delete Tool to the Toolbox, and then select it into the toolbox.
7. For HTML tags, you want to turn it to server controls, you can check and click Right click, select Run 8 on the server side, write client event handling scripts to name the HTML tag or client control, then in the code view , Select the corresponding control name and event
9.Web control only names, can be referenced in its label in the client script
10. Common code can be directly dragged into the toolbox as a tool reference
11. To reference the user control, you can drag the ASCX file of the user control to the design window, and the VS will automatically add the register tab for you.
12. To prevent others from compiling, you can use the code chaos tools that come with the VS, add the DLL, then generate, the generated code is mainly confusing some methods and classes.
13. To put the connection string into web.config, you can open the web.config file directly, join
Segment, join
Introducing, first import namespace: system.configuration, using configurationSettings.appsettings ["DSN"] can be referenced
14. Not necessary, do not use DataBinder.eval to access data in a manner ("column name") ["column name"], but use this method, you must join <% @ @ @ @ 列 x ImportNamespace = "system.data"%>
15. User controls can also define attributes and methods, however, if the property is defined, the control of the control can be done with a custom method, and cannot depend on the control of the control, because for Page_Load, These custom properties are still unable to see