Pages

Friday, December 30, 2011

C#.NET-InterviewQuestions

0 comments


Here are some common questions asked during technical interview, i have mentioned the answers for the questions which have short explanation, for rest of the questions which need some explanation i have written separate articles for them, you can get the answers in the articles posted on this blog site.


Q1. What are delegates?

Q2. What are multicast delegates? If the methods returns some values , then those methods can be used with multicast delegates? I.e. methods with return types can be used with multicast delegates?

Ans – No , method which are returning values could only be used with single cast delegate as in multicast delegate it will not be sure while executing which method is returning which value as multifunction are there in multicast delegate.
Continue reading →

ASP.NET State Management- Part3

0 comments


Limitations of Storing the session data within web server as an In-Process data:-

1.Inspite the site is maintained  in more than one webserver if the session data is stored as an InProcess data within webserver and if that server crashes then the other webserver cant read the session data and hence the response will not be provided to the client.

2. No Reliability:- Sessions  will be lost when appdomain is recycled[saving web.config or restarting webserver will recycle appdomain]
     To check :- open a website using sessions , execute it, now save changes on web.config while website is running ,now access the session data it will raise error because session expires due to saving changes in web.config file.

3. No Solution for Web Farming:- Web Farming is the concept of running different websites on default webservers as a one unit, this is implemented as a part of load balancing.
                Browser ---------------------------------- |         webserver
                                                                                            | ------- website1----session
                                                                                            |           
                                                                                            |---- Webserver----session[new]
                                                                                                         Website2
The single session cant be maintained for client within webfarming towards process dependent session.
Continue reading →

ASP.NET State Management- Part2

0 comments

Using Sessions: - It is used to maintain the user information across the web form present within the website by storing the data at the server side.
  
Enhancements for Sessions:-
  • ASP.NET supports cookie-based sessions and cookie-less sessions.[mainly all tech. supports only cookie-based sessions]
  • ASP.NET supports to enable or disable the sessions as per the requirement.
  • ASP.NET can maintain the session data as an In-process data i.e. within the webserver and also has an capability to maintain the data as an Out-process data i.e. within the StateServer or SqlServer database.[mainly all other tech. maintain within webserver only]
 
Continue reading →

ASP.NET State Management- Part1

0 comments


IIS [Internet Information Services]provided by Microsoft

ASP.NET towards windows requires IIS5.0 or later
ASP.NET towards Linux requires Apache webserver

-> After installing IIS:-

http://localhost ---> if it is personal pc

http://servername ---> if IIS is running in remote location [network environment]

Continue reading →
Thursday, December 29, 2011

IIS and Virtual Directory

0 comments


IIS [Internet Information Services]provided by Microsoft

ASP.NET towards windows requires IIS5.0 or later
ASP.NET towards Linux requires Apache webserver

-> After installing IIS:-

http://localhost ---> if it is personal pc

http://servername ---> if IIS is running in remote location [network environment]
Continue reading →

Use CssStyles with ASP.NET

0 comments


You can use CssStyles with ASP.net page in different ways :-

n       [HTML type]:-
External Style Sheet [Cascading Style sheet]: An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section.

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

Continue reading →

Different Ways to use JavaScript with ASP.NET

0 comments




You can add java-script to server controls in multi ways:- 
you can call Clientsidefunctions[javascript] from ClientSideEvents or ServerSideEvents


1. On body tag as a javascript single statement:-
 <body onload="javascript:document.forms[0]['Button1'].value=Date();">




2.Server's control's attribute property :-
Button1.Attributes.Add("onclick","javascript:alert('ALERT ALERT!!!')");
Continue reading →

How to start with JavaScript in ASP.NET pages

0 comments


Take a look at some of the more common uses of JavaScript in ASP.NET pages with some short examples.

Adding JavaScript to a Server Control

It is quite easy to add JavaScript to a specific server control that resides on an ASP.NET page. Let's take a look at the button server control as an example. If you drag and drop a Button HTML server control (HtmlInputButton Class) onto a page and run it as a server control, it should have the following construction:
<INPUT type="button" value="Button" runat="server" id="Button1">
This is a normal button that can be programmatically manipulated in the code-behind or server-side script of an ASP.NET page. For example, to assign the button text when the page is generated, simply use the value property of the button after this element is turned into an HTML server.
Continue reading →

Method attribute of Form tag

0 comments


Method attribute of Form tag in HTML which is used to submit data to other Form


This will specify arrangement standard for data, this provides Get option and Post option.
        Browser ----------------->>--------------- Web server
                         HTTP Request


   Data can be arranged:-


   HTTP header [using GET] - [http://....../login.htm] ----> like card


   HTTP message body [using POST] - [Internal representation] -->like cover or envelope


§         If it is "Get" data will be arranged under http header by appending to url called QueryString, it doesn’t provide security for password type data and supports less amount of data arrangement [max of 2kb].
§         If it is "Post”, data will be arranged under http message body, it provides security for password type data and supports large amount of data arrangement.
Continue reading →

URL? Webserver? Http-Protocol? Website? in a simple wordings.

0 comments


HTML Uniform Resource Locators

HTML Links

When you click on a link in an HTML document, an underlying <a> tag points to a place (an address) on the Web with an href attribute value like this: <a href="lastpage.htm">Last Page</a>.


URL - Uniform Resource Locator

Something called a Uniform Resource Locator (URL) is used to address a document (or other data) on the World Wide Web. A full Web address like this: http://www.w3schools.com/html/lastpage.htm follows these syntax rules:


scheme://host.domain:port/path/filename
Continue reading →

Why to implement IDisposable interface?

0 comments


Assuming you have created a Class in your system. Which is an appropriate way of notifying the class that the object is going out of scope?

By implementing the IDisposable interface, we will be forced to implement the Dispose method which can handle the notification and dispose the objects using unmanaged resources. The Using block will ensure that the Dispose method will get called at the end of the block. Otherwise another approach is that you would need to implement the Dispose method and call it manually right before the object went out of scope, which is partially correct, does not handle the problem of exceptions. If you wanted to use second approach you would have to call the Dispose method in a finally block using the try/catch/finally mechanism, which is, in fact, what the using block does for you.

Continue reading →

Url Encoding

0 comments


Steps for url Encoding:-


For ex:-        username-   sai 4u -tusr  [textbox]
                    password-   sri!!   -tpwd [textbox]
                      Login                  -btn1 [button]


1.combines all the names and values as pairs using "="
        tusr=sai 4u
        tpwd=sri!!
        btn1=Login


2.combines all the names and value pairs as a single expression using "&"
  for ex:-
     tusr=sai 4u&tpwd=sri!!&btn1=Login


3.Replaces all the blank spaces present within the expression using "+"
  for ex:-
     tusr=sai+4u&tpwd=sri!!&btn1=Login


4.Replaces all the non-alpha numerical values present within the expression with its relevant hexa-decimal value prefixed using "%"
  for ex:-
     tusr=sai%204u&tpwd=sri%21%21&btn1=Login


Note:- the above expression is the data which should be submitted from the client system to the server,if Get method is used then data will be passed as querystring[http header] and if post is used then in the form of byte stream[http message body]

Continue reading →

Working with GridView RowDataBound Event.

0 comments
The GridView in ASP.NET is a very powerful control that provides an easy interface to add, update, delete, and display data. The GridView also lets you perform other tasks very easily, such as paging and sorting your data, but not everything is as straightforward as it seems. Most of the time, we would display the data exactly as it comes out of our data sources, but sometimes we may need to manipulate the text, cells, and rows to fit our needs. In this article which I got after searching for long way on net, here its explained how to use the events and properties of the GridView to allow us to customise the way the data appears.

Continue reading →
Wednesday, December 28, 2011

Lock or Monitor or Mutex ?

0 comments


One of the benefits of using multiple threads in an application is that each thread executes synchronously. For Windows applications, this allows time-consuming tasks to be performed in the background while the application window and controls remain responsive. For server applications, multithreading provides the ability to handle each incoming request with a different thread. Otherwise, each new request would not get serviced until the previous request had been fully satisfied.However, the asynchronous nature of threads means that access to resources such as file handles, network connections, and memory must be coordinated. Otherwise, two or more threads could access the same resource at the same time, each unaware of the other's actions. The result is unpredictable data corruption.
Continue reading →

What are CLR, CTS and CLS?

0 comments


The .NET Framework has two main components: the Common Language Runtime (CLR) and the .NET Framework class library.

The CLR helps the execution of a code during runtime. CLR takes care of code management at program execution and provides various beneficial services such as memory management through Garbage Collector, thread management, security management, code verification, compilation, and other system services. The managed code that targets CLR benefits from useful features such as cross-language integration, cross-language exception handling, versioning, enhanced security, deployment support, and debugging. 

Continue reading →