1) What I should answer person on interview on question “Can User Control be stored in library?”


There are 3 types of controls:
1) User Control
2) Custom Control
3) Web parts

you can reuse User control in the current project in which you have built it but you can't move it to other project as unless you just copy paste the same file there and make the changes for that project ( which violets the concept of library).

but custom control can be shared between projects. and you can precompile them even as a dll so this means you can use them in library of any type.


Wats the exact answer-- YES or NO?

2)Which is the best session management system in ASP.Net - viewstate, cookies, application, Urlencoding? Justify?

1) Yes. You can store it in a library if it is versatile enough where it is reasonable to assume that you could benefit from using it in 2+ projects.
2) What do you mean? Cookies maintain a session ID on the client end so it remembers the ID but the server maintains the session for the defined timeout.

Viewstate has more to do with recreating a page than session management. Application=? Are you talking about including the session ID in the URL? This is a horrible idea because it becomes very easy to hijack a session. IE if you have an external link on your site then wherever that web traffic links to will have the session ID's in the referring URL of the client that clicked the link.

[edit]
Regarding #1 -- Think of all of the companies that sell custom controls for visual studio like fancy grids, rich text boxes, etc. Those *could* all be derived from a UserControl. You just have to make your design reusable enough to justify adding the control is a library
[/edit]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.