Friday, September 26, 2008

ASP.C# OOPS2

What do you mean by authentication and authorization?

Authentication is the process of vaLidating a user on the credentiaLs (username and password) and

authorization performs after authentication. After Authentication a user wiLL be verified for

performing the various tasks, It access is Limited it is known asauthorization.

What are different types of directives in .NET?

@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be

included only in .aspx files <%@ Page AspCompat3”TRUE” language3”C#” %>

@ControL:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be

included only in .ascx files. <%@ Control Language3”VB” EnableViewState3”false” %>

@Import: Explicitly imports a namespace into a page or user control. The Import           directive

cannot have more than one namespace attribute. To import multiple      namespaces,      use

multiple @Import directives. <% @ Import Namespace3”System.web” %>

@ImpLements: Indicates that the current page or user control implements the specified .NET

framework interface.<%@ Implements Interface3”System.Web.UI.IPostBackEventHandler” %>

@Register: Associates aliases with namespaces and class names for concise notation in   custom

server control syntax.<%@ Register Tagprefix3”Acme” Tagname3”AdRotator”

Src3”AdRotator.ascx” %>

@AssembLy: Links an assembly to the current page during compilation, making all           the

assemblyIs classes and interfaces available for use on the       page. <%@ Assembly

Name3”MyAssembly” %><%@ Assembly Src3”MySource.vb” %>

@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a

user control contained in a page<%@ OutputCache Duration3”#ofseconds” Location3”Any I Client I

Downstream I Server I None” Shared3”True I False” VaryByControl3”controlname” VaryByCustom3”browser

I customstring” VaryByHeader3”headers” VaryByParam3”parametername” %>

@Reference: Declaratively indicates that another user control or page source file should be

dynamically compiled and linked against the page in which this directive is declared.

How do I debug an ASP.NET appLication that wasn’t written with VisuaL Studio.NET and that doesn’t 

use code-behind?

Start the DbgClr debugger that comes with the .NET Framework SDK, open the file containingthe code you want to debug, and set your breakpoints. Start the ASP.NET application.

Go back to DbgClr, choose Debug Processes from the Tools menu, and select  aspnet_wp.exe from  thelist of processes. (If aspnet_wp.exe doesnIt appear in the list,check the ”Show system

processes” box.) Click the Attach button to attach to aspnet_wp.exe and begin debugging.

Be sure to enable debugging in the ASPX file before debugging it with DbgClr. You can   enable tell

ASP.NET to build debug executables by placing a <%@ Page Debug3”true” %>    statement at the top of an ASPX file or a   statement in a Web.config file.

Can a user browsing my Web site read my Web.config or GLobaL.asax fiLes?

No. The section of Machine.config, which holds the master configuration settings for ASP.NET, contains entries that map ASAX files, CONFIG files, and selected  other file types to an

HTTP handler named HttpForbiddenHandler, which fails attempts to retrieve the associated file. You

can modify it by editing  Machine.config or including an section in a local Web.config file.

What’s the difference between Page.RegisterCLientScriptBLock and Page.RegisterStartupScript?

RegisterClientScriptBlock is for returning blocks of client-side script containing functions.RegisterStartupScript is for returning blocks of client-script not    packaged in functions-in other words, code thatIs to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control3”MyControl.ascx” %>

What event handlers can I include in Global.asax? 

AppLication_Start,AppLication_End,

AppLication_AcquireRequestState, AppLication_AuthenticateRequest, AppLication_AuthorizeRequest,

AppLication_BeginRequest, AppLication_Disposed,  AppLication_EndRequest, AppLication_Error,

AppLication_PostRequestHandLerExecute, AppLication_PreRequestHandLerExecute,

AppLication_PreSendRequestContent, AppLication_PreSendRequestHeaders,

AppLication_ReLeaseRequestState, AppLication_ResoLveRequestCache,

AppLication_UpdateRequestCache, Session_Start,Session_End

You can optionaLLy incLude ”On” in any of method names. For exampLe, you can name a BeginRequest

event handLer.AppLication_BeginRequest or AppLication_OnBeginRequest.You can aLso incLude event

handLers in GLobaL.asax for events fired by custom HTTP moduLes.Note that not aLL of the event

handLers make sense for Web Services (theyIre designed for ASP.NET appLications in generaL, whereas

.NET XML Web Services are speciaLized instances of an ASP.NET app). For exampLe, the

AppLication_AuthenticateRequest and AppLication_AuthorizeRequest events are designed to be used

with ASP.NET Forms authentication.

Remoting

What distributed process frameworks outside .NET do you know?

Distributed Computing Environment1Remote Procedure CaLLs (DEC1RPC), Microsoft Distributed Component Object ModeL  (DCOM), Common Object Request Broker Architecture (CORBA), and Java Remote Method Invocation (RMI).




No comments: