Searching for ".NET."

Q:

Explain the concept of states in ASP.NET.

Answer

State is quite an innovative concept in Web development because it eliminates the drawback of losing state data due to reloading of a Web page. By using states in a Web application, you can preserve the state of the application either at the server or client end. The state of a Web application helps you to store the runtime changes that have been made to the Web application. For example, as already described earlier, a change in the data source of the Web application might be initiated by a user when he/she selects and saves some products in the shopping cart.

If you are not using states, these changes are discarded and are not saved. You may think that the whole concept of storing states is optional. However, under certain circumstances, using states with applications is imperative. For example, it is necessary to store states for Web applications, such as an e-commerce shopping site or an Intranet site of a company, to keep track of the requests of the users for the items they have selected on the shopping site or the days requested for vacation on the Intranet site.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET

Q:

You create an assembly by using Visual Studio .NET. The assembly is responsible for writing and reading order entry information to and from an XML data file. The assembly also writes and reads values to and from the Windows registry while it is being consumed.

 

The assembly will be distributed to client computers by using your company, XYZ, intranet. All client computers are configured to implement the default .NET security policy.

 

You need to implement security in the assembly. What should you do?

A) Implement declarative security and execute the permission demand to allow access to the file system and Windows registry. B) Implement declarative security and execute the minimum permission request to allow access to the file system and Windows registry.
C) Implement imperative security and execute the permission demand to allow access to the file system and Windows registry. D) Implement imperative security and execute the minimum permission request to allow access to the file system and Windows registry.
 
Answer & Explanation Answer: B) Implement declarative security and execute the minimum permission request to allow access to the file system and Windows registry.

Explanation:

You can use declarative code access security to request permissions for the entire assembly. SecurityAction flags that can be specified in an assembly-wide directive. When SecurityAction.RequestMinimum is specified, it makes a request to the common language runtime to be granted the requested permission. If the requested permission is not granted by the security policy, the assembly will not execute. A  Security Action.RequestOptional is similar, but the assembly will still run even if the requested permission is not granted. Specifying security Action. RequestRefuse requests that the assembly be denied the specified permission.

 

You must use the Assembly (assembly) directive when specifying these actions as follows: 

 

Option A:

There are only three Security actionAttributes targets for an assembly: RequestMinimumAssembly, RequestOptionalAssembly, and RequestRefuseAssembly. 

 

 Option C, D:

Imperative security does not work well to configure security for an entire assembly. In imperative security, permission to execute is demanded at run time.

Report Error

View Answer Report Error Discuss

Q:

Describe how to step through code in .NET.

Answer

Steps to step through the code in .NET:



  1. Start the program in debug mode.

  2. When the first breakpoint is reached then step through can be done in one of the two ways:



  •  Press F10 to move to next line.

  •  Select debug menu and click on step over. This would step over the breakpoint to next level.


       3. Other options are: “Step Into” and “Step Out”.

Report Error

View answer Workspace Report Error Discuss

Subject: .NET