. NET Pen Test set (v)

Source: Internet
Author: User
Tags httpcontext

1. What is a regulated code?

Answer: unsafe: Unmanaged code. Not run through the CLR.

What is the working principle of 2.net Remoting?
A: The server sends a process number to the client, a program field number to determine the location of the object.

The principle of 3.o/r Mapping
A: Use reflection to configure the mapping of objects and database tables.

4.remoting and WebService two technical understanding and practical application.
A: WS is primarily available with HTTP, penetrating firewalls. and remoting can use TCP/IP, binary delivery to improve efficiency.

5.out reserved words how to use, when to use.
A: Sometimes in order to return multiple values from a function, we need to use the Out keyword to assign the output value to a variable (that is, a parameter) passed to the method by reference. But C # requires that variables be initialized before they can be referenced. When you call this method, you also need to add the Out keyword.

What is 6.PDB? Where should it be placed in the debugging?

A: The PDB is a file for saving debugging and project status information, which will generate PDB files when debugging, and should be placed in the same directory as the corresponding application set at debug time.

7. What is the difference between an XML Web service using ASMX and a. NET remoting using SOAP?

A: The Web service uses the messaging mechanism, and remoting uses the RPC. Web service can be used on different platforms, in different languages, remoting only for. Net. Remoting is more efficient than XML Web Service.

8. Conceptually describe the difference between early binding (early-binding) and late binding (late-binding)?

This is like the comparison of the strength type, the early binding is at compile time to determine the data to be bound, and late binding is to fill the data when running. Therefore, if the early binding fails, the compile times compile the error, and late binding fails only when the runtime is running.

9. Overview of Reflection and serialization

reflection: assemblies contain modules, while modules contain types, and types also contain members. Reflection provides an object that encapsulates assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get a type from an existing object. You can then invoke a method of the type or access its fields and properties.

Serialization : serialization is the process of converting an object into a format that is easy to transfer. For example, you can serialize an object and then use HTTP to transfer the object between the client and the server over the Internet. At the other end, deserialization reconstructs the object from the stream.

How does 10.XmlSerializer work? What ACL permissions are required for processes that use this class?

All I know is that XmlSerializer is serializing and deserializing the properties and fields of an object, serializing it as XML data, and deserializing the XML into an object. You should require at least Read permissions in ACL permissions.

What are the benefits of the attribute-oriented pattern used by XmlSerializer? What problems have been solved?

Serialize only the useful data, not the entire object. Implement unnecessary data redundancy, and improve performance when serializing.

in a 12.SQLSERVER server, there are two field IDs in the given table Table1, and Lastupdatedate,id represents the updated transaction number . Lastupdatedate represents the server time when updating, use an SQL statement to obtain the last updated transaction number

Answer: Select ID from table1 Where lastupdatedate = (select MAX (lastupdatedate) from table1)

13. In object comparison, what are the object consistency and object equality respectively? A.equals (b) and a = = B?

Object consistency means that two objects are the same object, and the reference is the same. The equality of objects means that the values of two objects are the same, but the references are not necessarily the same.

Not the same. A.equals (b) indicates that a is consistent with B, and a==b that the value of a and B are equal.

14. Please explain iclonable

The IClonable method is an interface that implements deep replication, and it should be able to replicate an object in depth. The deeply copied feature of the calling object is constructed by creating a new object, including creating a new instance of the object in the nested reference object. Shadow replication, however, is a shallow copy and does not recreate the new instance. The implementation of the shallow copy is Object.memberwiseclone ().

Comparison of deep copy with shallow copy (Shadow copy)

View Code

15. Features can be placed on the parameters of a method? If yes, what's the use?

Yes, the function can be further qualified parameters, such as input parameters of type int, can be allowed to attributetargets=parameterinfo the attribute custom implementation to limit the size of the input parameters, such as when the input parameter is less than 100 when the error. example of setting attribute for a method parameter

View Code

16.WEB controls can fire server-side events, how do server-side events occur and explain their rationale? What is automatically returned? Why Use automatic returns.

When a Web control event occurs, the client submits the data back to the server in the form of a commit, the server invokes the Page_Load event, and then automatically invokes the server-side event based on the state information returned, and when we click on the client control, the data is passed directly back to the server using the submission form. Only the mechanism of server-side events can be implemented by automatic return, and if there is no automatic callback mechanism, only client events can be invoked, not server-side events.

17. Please explain important nodes in the Web. config file
appSettings contains custom application settings.
system.web System configuration
compilation dynamic debug compilation settings
customErrors custom error message settings
Authentication Authentication, this section sets the authentication policy for the application
Authorization Authorization, this section sets the authorization policy for the application

18. Please explain what the context object is, and under what circumstances the context object will be used
The context object refers to the current property of the HttpContext class and is used when we want to access the built-in object (Response,request,session,server,appliction, etc.) in a normal class

19. Dozens of millions of rows, how to quickly query out the table data

A: Use the paging stored procedure

View Code

database Query Optimization:
1, polymorphism, a variety of database compatibility;

2, support the page, support the total number of queries, page number display;
3, can handle more than 1 million of the amount of data;
For:

View Code

21. Two tables, write query statements, according to two fields one is ascending, one will be ordered.

A: SELECT * from a b where a. Field 1 = B. Field 1 order by a. Field 2 asc,b. Field 2 desc

22. A string of length 10000 that consists of randomly extracting 10,000 characters from A-Z. Please write the main program in C # language to implement.

View Code

23. Produce an int array with a length of 100, and randomly insert 1-100 into it, and cannot be duplicated.

View Code

24. Write a selection sorting algorithm in C #, requiring your own programming style.

View Code

25. Write a function to calculate the value when the parameter is N: 1-2+3-4+5-6+7......+n

View Code

26. Page life cycle?

The page life cycle performs a series of steps: Initialization of the page, instantiating the control, restoring and maintaining state, running the event handler code, rendering. In order to execute the required code at the appropriate stage, it is very familiar with the page life cycle. At each stage of the page life cycle, the page raises the defined events one by one, executing the program we need through the development of the Code, in the Life events of the page;

27. Page life cycle stage?
1. Page Request:Occurs before the page life cycle, when a user requests a page, ASP. NET determines whether the page needs to be parsed and compiled to determine whether to start the life cycle of the page, or whether the page cache can be sent without running the page to respond;
2. Start:Set page properties such as: HttpContext and other properties; At this stage, the page needs to determine whether the request is a postback or a new request, set the IsPostBack property, and set the UICulture property of the page;
3. Page initialization:Load all themes; control generation, and set UniqueID;
Note: The value in ViewState, ControlState is not loaded into the control, and if the page is postback, the postback data is not yet loaded, so the control can be accessed, but the value may be wrong;
4. Loading:Loads the values in ViewState and controlstate for the control if the current request is a postback request;
5. Verification:Invokes the Validate method of all validator controls, which sets the IsValid property of the validator control and the page;
6, postback event processing:If the request is a postback request, all event handlers are called;
7. Present:The view state is saved first for the page and all controls, and then the Render method is called for each control, which provides a text writer to write the input of the control to the outputstream of the Response property of the page;
8. Uninstall:When the rendering is complete and the page has been sent to the client, ready to discard the page, call uninstall. Will unload properties such as: response and request, etc.;

.page life cycle events? What about the life cycle of an ASP-server control?

1, PreInit
Done: Check the IsPostBack property to determine whether the page is being processed for the first time, create or recreate dynamic controls, dynamically set the master page, dynamically set the theme property, read or set profile properties;
Note: If the request is a postback request, the value of the control has not been restored from view state, that is, the control property should not be set in this event.
2. Init
Complete operation: Raised after all controls have been initialized and all appearance settings have been applied. Use this event to read and initialize the properties of the control;
3, InitComplete
Complete operation: Raised by the Page object, which is used to handle tasks that require all initialization work to be done;
4, preload
Complete the operation: Load the view state for the page and all controls, and then process any postback data included with the Request instance;
Note: This event is required if the page or control needs to be processed before load;
5. Load
Complete the operation: Load all controls recursively;
6. Control Events
Complete operation: Handles the event raised by the control;
Note: In a postback request, if the page contains a validator control, check the IsValid property of the page and the individual validation controls before performing any processing;
7, LoadComplete
8, PreRender
The last modification opportunity before the control output;
Note: The action before the event: the page Ensurechildcontrol operations recursively for all controls, and the data-bound control that sets the DataSourceID property invokes the DataBind method;
9, Savestatecomplete
The viewstate of the control has been saved before the event occurs.
10. Render
11, UnLoad
the life cycle of the server control is initialized, load view state, process postback data, load, send postback change notification, handle postback events, pre-render, save state, Render, Dispose, unload;

29. Application life cycle?
During the life cycle of an application, an application raises an event that can be handled and invokes a specific method that can be overridden. To handle application events or methods, you can create a file named Global.asax in the application root directory. If you create a Global.asax file, ASP. NET compiles it to a class derived from the HttpApplication class, and then uses that derived class to represent the application;
An instance of the HttpApplication process processes only one request at a time. This simplifies the application's event-handling process because it does not need to be locked when accessing non-static members in an application class. This also allows the request-specific data to be stored in non-static members of the application class. For example, you can define a property in the Global.asax file, and then assign a request-specific value to the property;
The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. During the life cycle of an application domain, ASP. NET calls these methods only once, not once for each HttpApplication instance;


when does the 30.asp.net page occur? And when is it destroyed?
1, Page_Init ()--Initialize the object
This process is primarily to initialize all the controls that include the page itself, and each time the page is loaded, an initial process is performed, and the original value of the control is also accessed here. There is also can be through the OnInit () to overload the initial event;
2, LoadViewState ()--Import ViewState data
After the initial event, all controls in the LoadViewState event will get their first property ViewState property, which will eventually be returned to the server to determine whether the page has been accessed by the user or is still being accessed by the user. You can also re-loadviewstate events to set the corresponding control value;
3, LoadPostData ()--processing Postback data with LoadPostData
Postback data can also be understood as the Server page submitted form data, each time the submission of the form data will trigger the execution of the IPostBackDataHandler interface operation of the control;
4, Page_Load ()--Import Object
This process is familiar, but also in the page every time the load must be executed, but note and Pageinit () the difference between, all the objects are first placed in the DOM page (in ASP.) and can be referenced by the code or the relevant location. This makes it easy for an object to get property values in HTML such as width, height, value, visibility, and so on, from the client. Frequently used Page.IsPostBack () indicates whether the page is being loaded in response to a client postback, or whether it is being loaded and accessed for the first time;
5. Handle control events--specific controls Events
This process executes the corresponding specific control event;
6, Page_PreRender ()--pre-submission object
The pre-Presentation object can change the object and change the last moments of the save. You can make final modifications to the properties of the control, the structure of the control tree, and so on, without considering any changes made to it by ASP. Because it is out of the database call and ViewState Update, can also be overloaded by OnPreRender;
7, Page_render ()-- presentation of the object to the page
All modifications to the page control are completed and ViewState is saved. The render event occurs when HTML is used to create a page that is output to the browser. During the render event, the page invokes objects in it to render them to HTML. The page can then be accessed by the user's browser in the form of HTML. When the render event is overloaded, developers can write custom HTML code that invalidates the original generated HTML and organizes the page according to the new HTML. The Render method uses an HtmlTextWriter object as a parameter and it displays the HTML as a Web page in the browser. There are still some modifications you can make, but they are just some of the changes on the client side. The render event can also be overloaded;
8. Unload event--Unload Object
When the server requests an object, it generates an inherited page object in memory, which is the class of the page, which inherits from System.Web.UI.Page. Occurs when a Page object is unloaded from memory, triggering the event;
9. Dispose Method called
All objects should be destroyed after the presentation to HTML is complete. In the Dispose event, you should destroy all the objects that were created when the page was built. At this point all processing is complete, so destroying any remaining objects will not cause errors, including the Page object. You can overload the Dispose event;

. NET Pen Test set (v)

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.