ASP.NET Interview Questions and Answers (1544) - Page 44

State some basic advantages of url-rewriting ?

(1) Hide the page extension. From security aspect, it is always better to not show the extension (this concept is shown in ASP.NET MVC).

(2) Dynamic url's increase the rank of the page.

(3) It would make the url simple and more readable.



Thanks and Regards
Akiii
How will you access a TextBox contains in a Master Pages from Content Page?

We can access master page controls from the content pages.For examples :-

TextBox txtbx = (TextBox)Master.FindControl("txtMaster");

txtbx .Text = "DotnetFunda";


In the above code, FindControl is a method which is taking name of the control which is in the master page. Then it is casting in the textbox. Now, with the help of the text property we can assign any property.



Thanks and Regards
Akiii
State two dis-advantages of ViewState in ASP.NET ?

(1) Security -- The view state is stored in a hidden field on the page. Although view state stores data in a hashed format, it can easily be tampered.

(2) Performance -- The view state is stored in the page itself, so increases the page size. Hence the performance is decreased if you store loads of information in the viewstate.




Thanks and Regards
Akiii
What is Code Metrics ?

Code Metrics generally belong to the Code Re-factoring group. Its a measures of some property of a piece of software that provides developers better insight into the code they are developing.



Thanks and Regards
Akiii
When calculating code Metrics, what is Maintainability Index ?

Maintainability Index calculates an index value between 0 and 100 that represents the relative ease of maintaining the code. A higher value means better maintainability.

20 to 100 --- good maintainability

10 to 19 --- moderately maintainable
0 to 9 --- low maintainability




Thanks and Regards
Akiii
When calculating Code Metrics, what is Cyclomatic Complexity ?

Cyclomatic Complexity refers to the structural complexity of the code. Here, different code paths in the flow of the program are calculated.

A complex control flow requires a more tests to achieve good code coverage. hence, the code will be less maintainable.



Thanks and Regards
Akiii
When calculating Code Metrics, what is Depth of Inheritance ?

Depth of Inheritance shows the number of class definitions that extend to the root of the class hierarchy. The deeper the hierarchy the more difficult it might be to understand where particular methods and fields are defined or/and redefined.



Thanks and Regards
Akiii
When calculating Code Metrics, what is Class Coupling ?

Class Coupling measures the coupling to unique classes through parameters, local variables, return types, method calls, generic or template instantiations, base classes, interface implementations, fields defined on external types, and attribute decoration.

A Good software design dictates that types and methods should have high cohesion and low coupling.

High coupling indicates a design that is difficult to reuse and maintain because of its many inter-dependencies on other types.


Thanks and Regards
Akiii
Briefly list the steps of Form Authentication process ?

The steps are :-

(1) Open the url for example(www.testing.com)
(2) Login page opens.
(3) User enters user name and password and submits these to the server.
(4) Server validates the credentials and if valid, creates an authentication cookie and sends it back to the user browser.
(5) With valid cookie, user no longer needs to enter a user name and password to access the site on each page request.
(6) From next time he/she is simply redirected to the default page.



Thanks and Regards
Akiii
Explain "Remember Me" option in ASP.Net Forms Authentication ?

ASP.Net Forms Authentication has a feature to allow the application to "Remember Me." This is seen on many login screens with respect to different websites. By default, the only thing this built in checkbox does is determine if the authentication cookie should be persistent or non-persistent . When the checkbox is checked, the cookie will be persistent and live on even the browser is closed until it expires according to its timeout property otherwise the cookie will be non-persistant and will remain only for that session.



Thanks and Regards
Akiii
What is the default name that will be given if no cookie name is provided in Asp.Net Forms Authentication ?

NOTE: This is objective type question, Please click question title for correct answer.
What does the SignOut() method do in Asp.Net Forms Authentication ?

SignOut() method removes the form authentication ticket otherwise known as cookie from the browser.

For example, if you want to sign out from the site and destroy all the cookies previously created then you write the code as following :-

FormsAuthentication.SignOut();


Thanks and Regards
Akiii
In Asp.Net Forms Authentication, what are the two ways where you can specify the timeout property ?

In Asp.Net Forms Authentication, timeout property can be specified in two ways :-

(1)
web.config file

(2)
programmatically in the code




Thanks and Regards
Akiii
In Asp.Net Forms Authentication, how can you specify the timeout property in web.config file ?

In web.config file, you specify the timeout property as :-

<system.web>

<authentication mode="Forms">
<forms name="Deviant_Akiii" loginUrl="login.aspx" timeout="30" defaultUrl="default.aspx" cookieless="UseCookies" slidingExpiration="true">
</forms>
</authentication>
</system.web>


In the above code, the timeout of the cookie is 30 minutes . The name property in the form tag is the name of the cookie (that is) Deviant_Akiii



Thanks and Regards
Akiii
In Asp.Net Forms Authentication, how can you specify the timeout property programmatically ?

Timeout property programmatically :-

HttpCookie cookie  = FormsAuthentication.GetAuthCookie (txtUserName.Text, true);

' Expires in 30 days, 10 hours and 00 minutes from today.
cookie.Expires = DateTime.Now.Add(New TimeSpan(30, 10, 20, 0));
Response.Cookies.Add (cookie);
Response.Redirect (FormsAuthentication.GetRedirectUrl (txtUserName.Text, true));




Thanks and Regards
Akiii
Suppose you want a certain ASP.NET function executed on MouseOver over a certain button. Where do you add an event handler ?

It’s the Attributesproperty, the Add function inside that property. So,

btnSubmit.Attributes.Add("onMouseOver","someClientCode();")


A simple”Javascript:ClientCode();” in the button control of the .aspx
page will attach the handler (javascript function)to the onmouseover event.
What data type does the RangeValidator control support ?

The RangeValidator control supports Integer,String and Date.

Example:

<asp:RangeValidator 

id="ProgrammaticID"
ControlToValidate="ProgrammaticID of control to validate"
MinimumValue="value"
MaximumValue="value"
Type="DataType"
ErrorMessage="Message to display in ValidationSummary control"
Text="Message to display in control"
ForeColor="value"
BackColor="value"
runat="server" >
</asp:RangeValidator>

What is delay signing ?

Delay signing allows you to place a shared assembly in the GAC by signing the assembly with the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed.
This process enables developers to work with shared assemblies as if they were strongly named. It also secures the private key of the signature from being accessed at different stages of development.
what is NuGet ?

It is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework.

When you add a library or tool, NuGet copies files to your solution and automatically makes whatever changes are needed in your project, such as adding and changing your app.config or web.config file.

NuGet runs in Visual Studio 2010 or Visual Web Developer 2010.
What are global variables ?

Global variables are variables which can store any type of data and which can be accessed anywhere in the application irrespective of user's session.

Global variables must always be used with caution as it causes threading problems.


Thanks and Regards
Akiii
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories