Skip to main content

Posts

Showing posts from August, 2010

70-562 Custom Visualizers

Framework objects are clearly viewable in the locals window during debugging. User made class librairies and their object need to provide visualizers for maintenance and debugging. You can create your own visualizers, MS exposes the functionnality through the .Net Framework; and this is relatively easy. Mulitple visualizers can be created per type. You can have tree views, grids; customizing it to the way that is the most usefull for debugging this particular object. The [Serializable()] attribute has to be included to your class to allow the visual studio visualizer to parse the object. A visualizer is a dll, a regular assembly, it requires a windows form to display the data. The visualizer class will be implemented by the form. The visualizer class has to inherit the DialogDebuggerVisualizer class with the DebuggerVisualizer attribute, and also the Microsoft.VisaulStudio.DebuggerVisualizers namespace. The visualizer can be made to only read, or modify existing data. T

70-562 Javascript Debugging From Visual Studio

INTRO Client side debugging improved in the recent years. Visual studio 2008 or later, combined with Internet explorer can provide client side debugging as seambless and as rich as debugging server side code within visual studio. The problems visual studio had was that server control generated alot of HTML, and in many case generate javascript at run time based on the conditions on the page. Ajax magnifies the problem, adding torturous volume of javascript code to control the user's every interaction with the page. For visual studio, mapping the code at run time to the original source code was a difficult problem; while in server side debugging the debugger can easily map your source code to the code executing at run time. Now microsoft has solved the mapping problem with client side code. Client side debugging in previous versions of visual studio can be left behind, in visual studio 2008 it's a brand new experience. REQUIREMENTS Everything required for client side deb

70-562 Debugging Support Windows

Locals window : It shows data in the scope. Instead of adding a watch, open the locals window, it will show the objects within the method up to the statetement executing. Watch and quickwatch : enter a variable name, or right click them . Call stack and Threads : to understand the context, click any methods in the stack and the corresponding file will open. When using the thread window, keep in mind that on a signle cpu, one thread is active at a time, their can be many in the list, but only one at a time is active. The active thread is the thread that is currently able to run, it's possible to select another thread and switch to it, freezing prevents execution, thawing allows execution. The exception assistan t puts in break mode and allows to check values of variables. To view possible exceptions, go to Debug->Exceptoions, and check the exception you want to break on. From the exception assistant, open the view detail link to view the properties window. Debugging stor

70-562 Server debugging

Server Debugging Can debug locally or remotely Also known as the debuggin experience...customizable from Options->Debugging Like Configure the exception assistant, Enable Assistant. The option is usefull in asp.net as the browser determines the possibility to debug client side code.  The  project option also allows to debug native and SQL Server code. The attribute needs to be on to debug, but never in production. Debug->windows->breakpoints, gives a list of the break points, and also add colums to that window. Tracepoints: performing actions based on breakpoints. Right click the breakpoint, select . you can use the $variables or the {Header} expression, set it to not break on the breakpoint and open the output window. This can be usefull if you don't want to step through the code or if stepping through would change the behavior of the application(thread timers).

70-562 Membership API

Membership clas s: Provides the api to manage users, create, find, generatePassword, ValidateUser, and more... MembershipUser Clas s: Stores name, email, password, question/answer, but doesnt manager user defined properties like profiles GetPassword, ResetPassword, UpdateUser, properties describing user info. One could make a page that allows to find users, delete user, select user from a listView control, which would provide a details view and update a password, or button to reset it. Managing users from your own interface instead of configuration manager or web.config API : MembershpiCreateStatus, Membership.Createuser(...), Membership.GetallAllUsers() retunrs an array of users. Membership.DeleteUser(strUserName), MembershipUser user = Membership.GetUser(strUserName), user.ChangePassword(old, new), user.ChangePaswwrdQuestionAndAnswer(...), Membership.FindUsersByEmail(strUserName), Membership.FindUserByName(strUserName), user.ResetPassword(oldPassword), Managing Roles from yo

70-562 Membership Controls

No role based control are already inculded in the 3.5 framework, but there are membership controls for almost every authentication and authorization scenario, already built in the 3.5 framework, which allows to create controls fast, with little to no code. Using these will allow other .net developpers to quickly understand (and maintain as necessary) your security controls since they are common knowledge. They are easy to modify and also customizablelook and feel. They are rich server controls, so integrate other smaller controls. They integrate seamlessly with existing security feature like     LoginStatus: displays a link to logout if you're logged in, take to the specified page, it's possible to set the text of the link, and an event occurs before he attemps to login our or log, and also one event after. Available from the toolbox in the login section. The smart tag in design mode allows to toggle from login and logout. Login: takes data from a user that isent au

70-562: Intro to Membership

Previously to .net 2.0, asp.net developers had to choose between windows or form authentication to implement membership. In form authentication, the data storage had to be created, the business logic to manage the roles and permissions, and the presentation layer for login logout had also to be created. Now in 2.0 and beyond, the membership API is enhances and replaces previous  authentication and ahtorization features,  and has Membership and roles built in, can be used on any with any datastore, can create custom membership and roles providers, the provider allows to to store in any asource. Password management is taken care of in terms of storing reseeting and reminding. User authentication. Controls make it simple to use these features, they are exensible and templated. Also provides a full featured api so your own membership management can interact with it Typically, add and delete roles, retrieve lists of users in each role, retrieve list of roles for each user, cache role 

70-562 Configuring State

CONFIGURING SESSION STATE Look for the SessionState element in the web.config file. StateServer can be used for a dedicated state server, a sql database can also be used, cookieless session state, and customcookie name, regenerating expired session ids, the timeout for the session with a default of 20 minutes. This element wont be found by default in the default web.config files and web.config files, they use the default and are added manualy to override the defaults. The "mode" attribute, can be Off if session state is not used, InProc is the default and sessions are lost when the server is reset, it's the oldest and performs the fastest since its' in Memory. SessionState is hosted by a windows service installed with the asp.net framework then it is stored in mem on that machine. SQLServer requires sql and a script provided by asp.net to configure it to store state. Custom is by implementing the SessionSTateStoreProvider class. Advantage of StateServer and