Wednesday, December 21, 2011

Technical Jargons

Web 2.0
Web 2.0
*******************************
Cloud Computing
Clud Computing

Wednesday, December 7, 2011

Using xmlhttp to POST soap request for WSE 3.0 enabled Webservice


Consider a situation,
You have a WSE 3 enabled Webservice(developed in dotnet) and you have to access that without creating PROXY.

We can do this by creating XMLHTTP object and then construct SOAP request

But the problem is in creating the proper request with valid Authentication header. Many times we will end up creating invalid request mostly invalid authentication headers

But there is a easy way. Two tools comes handy for us to implement and test this.
1) Fiddler for creating request
2) SOAPUI for validating and testing

Let me write down the steps in numerical order

1)Create a dotnet application (windows form or console app) and add web reference to your web service
2)Add a WSE client policy config file and attach a authentication token to you proxy
Private Sub DoSettingsForWSE3(ByRef serviceProxy As MyWebService)

Dim strUserName As String = "uname"
Dim strPassword As String = "pwd"
Try
'init web service proxy
serviceProxy = New MyWebService

' Init UsernameToken, password is the reverted
' String of username, the same logic in AuthenticateToken
' of ServiceUsernameTokenManager class.
Dim token As New UsernameToken(strUserName, strPassword, PasswordOption.SendPlainText) 'or encrypted/hased

' Set the token onto the proxy
serviceProxy.SetClientCredential(token)

' Set the ClientPolicy onto the proxy
serviceProxy.SetPolicy("client polciy config")

Catch ex As Exception
Throw
End Try

End Sub

3) Run the test client app and copy the Request constructed from FIDDLER tool

4) Look for the authentication header section from the request constructed by Fiddler.

5) Copy them and test it in SOAPUI tool. 90% you will not go wrong in the authentication part if you do this way.

6) we need to tweak the request in some ways so that it does not expire. Alter the expiration date on the authentication header to some very high future date.

Actually I was struggling to achieve this portion of creating a valid request and then I figured out the way now and would like to share.

Thursday, November 3, 2011

Resources

Resources
Design Patterns
http://dofactory.com


*****************************************************


Interview Questions
C#-asp.net
*****************************************************

Agile

1) Agile-Scrum
.net
1) http://repeatgeek.com/technical/
Source control
2)http://repeatgeek.com/technical/17-websites-for-sharing-programming-knowledge/

1) GIT : http://git-scm.com/

2) SOS :

Bedtime Stories
1)http://www.storyteller.net/stories/text/21

2) http://www.kellscraft.com/BestStories/beststoriescontentpage.html
Good Thoughts

1) http://powertochange.com

Friday, October 28, 2011

Learn One good thing a day

I wanted to Lean one good thing a day and keep practicing it

I am learning sometimes but fail to practice mostly. Need the determination.

http://www.susanjeffers.com/home/books.cfm


http://www.ted.com/talks/dean_ornish_says_your_genes_are_not_your_fate.html

Monday, September 12, 2011

Worth remembering

LETTER FROM ABRAHAM LINCOLN TO HIS SON’S TEACHER “My son starts school today. It is all going to be strange and new to him for a while and I wish you would treat him gently. It is an adventure that might take him across continents. All adventures that probably include wars, tragedy and sorrow. To live this life will require faith, love and courage. So dear Teacher, will you please take him by his hand and teach him things he will have to know, teaching him - but gently, if you can. Teach him that for every enemy, there is a friend. He will have to know that all men are not just, that all men are not true. But teach him also that for every scoundrel there is a hero, that for every crooked politician, there is a dedicated leader. Teach him if you can that 10 cents earned is of far more value than a dollar found. In school, teacher, it is far more honorable to fail than to cheat. Teach him to learn how to gracefully lose, and enjoy winning when he does win. Teach him to be gentle with people, tough with tough people. Steer him away from envy if you can and teach him the secret of quiet laughter. Teach him if you can - how to laugh when he is sad, teach him there is no shame in tears. Teach him there can be glory in failure and despair in success. Teach him to scoff at cynics. Teach him if you can the wonders of books, but also give time to ponder the extreme mystery of birds in the sky, bees in the sun and flowers on a green hill. Teach him to have faith in his own ideas, even if every one tell him they are wrong. Try to give my son the strength not to follow the crowd when everyone else is doing it. Teach him to listen to every one, but teach him also to filters all that he hears on a screen of truth and take only the good that comes through. Teach him to sell his talents and brains to the highest bidder but never to put a price tag on his heart and soul. Let him have the courage to be impatient, let him have the patient to be brave. Teach him to have sublime faith in himself, because then he will always have sublime faith in mankind, in God. This is the order, teacher but see what best you can do. He is such a nice little boy and he is my son"

Monday, January 24, 2011

Accessing Data with ADO.net 4.0

EDM splitting

The key factor for Entity Splitting is both entities should share a common primary key

Friday, January 7, 2011

WebSite Performance Improvements

1) ViewState

Keep you viewstate light or no viewstate wherever possible

Note : Prevent any user from obtaining any part of the view state by using PageStatePersistor class http://aspnetresources.com/blog/page_state_persisters_overview

Scalability and Distributed Caching

This topic I need to learn more. Will soon update with more feeds

Things to do to scale you web application

1)Use SQL Server replication

also refer to http://www.c-sharpcorner.com/uploadfile/gopenath/page107182007032219am/page1.aspx

MultiThreading in Asp.net Web apps

Multi threading in asp.net can be achieved using two ways
1)Using BackgroundWorker class
2)Spanning new process thread on user interaction

While handling resource intrinsic operations concurrently like sending 1000s of email on a button click we have to use a separate process for every user

If the operation is global to the application but needs to be done in background then use Backgroundworker class

Error Handling

1) In MVC we can centralize the logic for handling and logging unhandled exceptions
by Decorating the controller classes with the [HandleError] attribute
Using the above class level attribute we can handle exceptions of specific type with separate customized views. There are other Action Filter attributes also [Authorize],[OutputCache]

Pls look into below link for details
http://www.pnpguidance.net/post/ASPNETMVCFrameworkPreview4HandleErrorAuthorizeOutputCacheActionFilterAttributes.aspx


Developing Web Application to be optimized for Search Engines

The key features responsible for optimizing our web application for Search Engines. Listing out one by one

1)HTML rendered by the web application
set the Render Outer table property to false on all Form View controls

MCPD 4.0 preparation

I am consolidating the key features in .net 4.0 during the process of learning for MCPD certification


1) Client ID mode property for user controls

Very useful property settings while referring to user controls from client side javascripts of the parent page. Setting ClientIdMode property to the value "Predictable" will remove all unwanted long strings before the id of the user controls. For more info refer to
http://blog.hmobius.com/post/2010/02/25/ASPNET-Part-8-Introducing-ClientIDMode.aspx


2) [DebuggerBrowsable] attribute

If you want to hide a class member variable from display to users even in debugging mode follow the 2 steps. Make the variable private and also decorate it with DebuggerBrowsable] attribute . For more details pls check
http://www.dailycoding.com/Posts/using_debuggerbrowsable_attribute_for_a_better_view_in_debugger_window.aspx



3)HTMLHelper Extension methods
These extension methods are used for programmatically adding reusable user-interface code to views and allowing the user-interface code to be rendered from the server side. These methods will render HTML controls. You can use helper methods that map to different HTML tags on the fly. (eg)<%= Html.Span("About page...") %>



4) MVC-RenderPartial vs RenderAction extension methods
There is a big difference between renderaction and renderpartial. RenderPartial will render a View on the same controller (or a shared one), while RenderAction will actually perform an entire cycle of MVC, that it, it will instantiate the controller (any controller you mention, not the current one only), it will execute the action, and it will then return and render the result.
http://stackoverflow.com/questions/719027/renderaction-renderpartial


http://www.slideshare.net/1kevgriff/aspnet-mvc-from-the-ground-up





5)Configure the Web application for constrained delegation
If you want the database to be accessed under the identity of the user connected to the web application then use constrained delegation



6)Avoid SessionID spoofing by inheriting SessionIDManager class and Customizing it.
in situation when sessionstate =cookieless in web.config



7)Keeping connectionstrings in external source and avoid web app restart on modifying the machine.config file
First we need to specify the configsource property to an external file.Keep the external file extension as .config as other file types can be browsable through webURL. Inorder to read the config entries from external config file we need to maintain the same config section in the external config file
http://aspalliance.com/820





8)To set the culture and UI culture for an ASP.NET Web page programmatically
1.Override the InitializeCulture method for the page.
2.In the overridden method, determine which language and culture to set the page to.



9)Nullable types:The ability to assign null to numeric and Boolean types
eg) int? num = null;



10) MVC2- Area
To accommodate large projects, ASP.NET MVC lets you partition Web applications into smaller units that are referred to as areas. Areas provide a way to separate a large MVC Web application into smaller functional groupings. An area is effectively an MVC structure inside an application. An application could contain several MVC structures (areas).
When you add an area to a project, a route for the area is defined in an AreaRegistration file. The route sends requests to the area based on the request URL. To register routes for areas, you add code to the Global.asax file that can automatically find the area routes in the AreaRegistration file. add the below code isn global.asax
AreaRegistration.RegisterAllAreas();

11)Render values from resource file in asp.net controls
eg) <asp:TextBox runat="server" Id="text" Text="<%$ Resources:WebResources, lblCompanyText %>"/>





12)

Accessing Data with ADO.net 4.0



POCO-Plain Old CLR objects

http://blogs.msdn.com/b/adonet/archive/2009/05/21/poco-in-the-entity-framework-part-1-the-experience.aspx
http://blogs.msdn.com/b/adonet/archive/2009/05/11/sneak-preview-persistence-ignorance-and-poco-in-entity-framework-4-0.aspx
http://blogs.msdn.com/b/adonet/archive/2009/05/28/poco-in-the-entity-framework-part-2-complex-types-deferred-loading-and-explicit-loading.aspx

Patterns behind the concept of Entity Framework is
The Repository Pattern http://msdn.microsoft.com/en-us/library/ff649690.aspx
Unit of Work

Eager Loading Vs Deferred(Lazy) Loading
http://blogs.msdn.com/b/adonet/archive/2009/05/28/poco-in-the-entity-framework-part-2-complex-types-deferred-loading-and-explicit-loading.aspx


CSDL, SSDL, and MSL Specifications
CSDL-Conceptual Schema Design Language
SSDL-Store Schema Design Language
MSL-Mapping Schema Language




13) Dynamic keyword in c#4.0
Example for using Dynamic keyword
object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember(
"Add", BindingFlags.InvokeMethod,
null, new object[] { 10, 20 });
int sum = Convert.ToInt32(res);
Th e function returns a calculator, but the system doesn’t know the
exact type of this calculator object at compile time. Th e only thing
the code relies on is that this object should have the Add method.
Note that you don’t get IntelliSense for this method because you
supply its name as a string literal.
With the dynamic keyword, this code looks as simple as this one:
dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);
The assumptions are the same: There’s some object with an
unknown type that we expect to have the Add method. And similar
to the previous example, you don’t get IntelliSense for this method.
But the syntax is much easier to read and use and looks similar to
calling a typical .NET method.