Overblog Follow this blog
Edit post Administration Create my blog
November 28 2010 1 28 /11 /November /2010 07:11
 

WCF FAQ Part 3 – 10 security related FAQ

Get Interview tutorials and videos on .NET 3.5, 4.0, WCF,ASP.NET, SQL Server, CAS, Security, WCF, SharePoint, Azure, OOPS and many more on www.questpond.com


This 10 minutes small video explains how transport security can be implemented using SSL in WCF services.


1.jpg

 




Introduction and Goal


WCF FAQ Part 1 and 2 series

What are the core security features that WCF addresses?

What is transport level and message level security?

For which bindings are transport, message and mixed mode supported?

So what are the scenarios, advantages and disadvantages of transport VS message security?

Can you explain a simple example of how to implement transport security?

Can you show a simple example of message level security ?

What is the difference between BasicHttpBinding and WsHttpBinding ?

Can you show the security differences between BasicHttpBinding VS WsHttpBinding ?

When should we use WsHttp as compared to BasicHttp ?

How can we enable windows authentication on WCF using ‘BasicHttpBinding’?

Source Code

 

 

Introduction and Goal

In this article we will start with transport and message security understanding. We will then see simple code samples of how to implement transport and message security using WsHTTP bindings. We will also see what is the difference between ‘BasicHttpBinding’ and ‘WsHttpBinding’ with the help of a simple source code. WCF security is a huge topic by itself, but we are sure with this article you will get a quick start of how to go about WCF security.

I have collected around 400 FAQ questions and answers in WCF, WPF, WWF, SharePoint, design patterns, UML etc. Feel free to download these FAQ PDF’s from my site http://www.questpond.com


What are the core security features that WCF addresses?

There are four core security features that WCF addresses:-

Confidentiality: This feature ensures that the information does not go in wrong hands when it travels from the sender to the receiver.

Integrity: This feature ensures that the receiver of the message gets the same information that the sender sends without any data tampering.

Authentication: This feature verifies who the sender is and who the receiver is.

Authorization: This feature verifies whether the user is authorized to perform the action they are requesting from the application.


2.JPG




What is transport level and message level security?

When we talk about WCF security there are two aspects, the first is the data and the second is the medium on which the data travels i.e. the protocol. WCF has the ability to apply security at the transport level (i.e. protocol level) and also at message level (i.e. data).


3.JPG


Figure: - Transport and Message level security
 

Transport level security happens at the channel level. Transport level security is the easiest to implement as it happens at the communication level. WCF uses transport protocols like TCP, HTTP, MSMQ etc and every of these protocols have their own security mechanisms. One of the common implementation of transport level security is HTTPS. HTTPS is implemented over HTTP protocols with SSL providing the security mechanism. No coding change is required it’s more of using the existing security mechanism provided by the protocol.

Message level security is implemented with message data itself. Due to this it is independent of the protocol. Some of the common ways of implementing message level security is by encrypting data using some standard encryption algorithm.


For which bindings are transport, message and mixed mode supported?

Note :- The below table is taken from book Pro WCF: Practical Microsoft SOA Implementation -- Chris peiris and Denis mulder – Apress 2007

Below is a table which shows for which binding which mode is supported. We did not discuss the mixed mode. It’s nothing but combination of transport and mixed mode. For instance data encrypted and passed over WsHttp using HTTPS is a mixed mode of security. Encryption is nothing but message security and HTTPS is a transport mode. In a combination they form mixed mode.

Binding

Transport Mode?

Message Mode?

Mixed Mode?

BasicHttpBinding

Yes

Yes

Yes

WsHttpBinding

Yes

Yes

Yes

WsDualHttpBinding

No

Yes

No

NetTcpBinding

Yes

Yes

Yes

NetNamedPipeBinding

Yes

No

No

NetMsmqBinding

Yes

Yes

No

MsmqIntegrationBinding

Yes

No

No

 

So what are the scenarios, advantages and disadvantages of transport VS message security?

 

 

Transport

Message

Scenarios when we should be using one of them

When there are no intermediate systems in between this is the best methodology.  

If it’s an intranet type of solution this is most recommended methodology.

When there are intermediate systems like one more WCF service through which message is routed then message security is the way to go.

Advantages

  • Does not need any extra coding as protocol inherent security is used.
  • Performance is better as we can use hardware accelerators to enhance performance.
  • There is lot of interoperability support and communicating clients do not need to understand WS security as it’s built in the protocol itself.

 

  • Provides end to end security as it’s not dependent on protocol. Any intermediate hop in network does not affect the application.
  • Supports wide set of security options as it is not dependent on protocol. We can also implement custom security.

Disadvantages

  • As it’s a protocol implemented security so it works only point to point.
  • As security is dependent on protocol it has limited security support and is bounded to the protocol security limitations.
  • Needs application refactoring to implement security.
  • As every message is encrypted and signed there are performance issues.
  • Does not support interoperability with old ASMX webservices/

4.JPG



Figure: - Route paths
 

Can you explain a simple example of how to implement transport security?

Let’s make a simple sample which will demonstrate how we can use transport security using WsHttp binding with HTTPS security.

Step 1:- Create a simple service using WCF project

The first step is to create a simple WCF project. So click on new project and select WCF service project. By default WCF project creates a default function ‘GetData()’. We will be using the same function for this sample.

 public class Service1 : IService1 { public string GetData(int value) { return string.Format("You entered: {0}", value); } public CompositeType GetDataUsingDataContract(CompositeType composite) { if (composite.BoolValue) { composite.StringValue += "Suffix"; } return composite; } } 

Step 2 :- Enable transport level security in the web.config file of the service

Next step is to enable transport security in WsHttp binding. This is done using the ‘Security’ XML tag as shown in the below code snippet.

 <bindings> <wsHttpBinding> <binding name="TransportSecurity"> <security mode="Transport"> <transport clientCredentialType="None"/> </security> </binding> </wsHttpBinding> </bindings> 

Step 3:- Tie up the binding and specify HTTPS configuration

We need now tie up the bindings with the end points. So use the ‘bindingConfiguration’ tag to specify the binding name. We also need to specify the address where the service is hosted. Please note the HTTS in the address tag.

Change ‘mexHttpBinding’ to ‘mexHttpsBinding’ in the second end point.

 <service name="WCFWSHttps.Service1" behaviorConfiguration="WCFWSHttps.Service1Behavior"> <!-- Service Endpoints --> <endpoint address="https://localhost/WCFWSHttps/Service1.svc" binding="wsHttpBinding" bindingConfiguration="TransportSecurity" contract="WCFWSHttps.IService1"/> <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> </service> 
 In the ‘serviceMetadata’ we also need to change ‘httpGetEnabled’ to ‘httpsGetEnabled’. 
 <serviceBehaviors> ........ ......... <serviceMetadata httpsGetEnabled="true"/> ......... ......... </serviceBehaviors> 

Step 4:- Make the web application HTTPS enabled

Now that we are done with the WCF service project creation and the necessary configuration changes are done. It’s time to compile the WCF service project and host the same in IIS application with HTTPS enabled.

We will be using ‘makecert.exe’ which is a free tool given by Microsoft to enable HTTPS for testing purpose. MakeCert (Makecert.exe) is a command-line tool that creates an X.509 certificate that is signed by a system test root key or by another specified key. The certificate binds a certificate name to the public part of the key pair. The certificate is saved to a file, a system certificate store, or both.

You can get the same from “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin” or you can also get it from windows SDK.

You can type the below thing through your dos prompt on “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin”. Please note “compaq-jzp37md0” is the server name so you need to replace with your PC name.

makecert -r -pe -n "CN= compaq-jzp37md0 " -b 01/01/2000 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12
 

If you run the same through your command prompt you should get a succeeded message as shown below.


5.jpg



Now it’s time to assign this certificate to your IIS website. So go to IIS properties , click on directory security tab and you should see server certificate tab.


6.jpg




So click on the server certificate tab and you will then be walked through an IIS certificate wizard. Click ‘Assign a existing certificate’ from the wizard.

7.jpg



You can see a list of certificates. The “compaq-jzp37md0” certificate is the one which we just created using ‘makecert.exe’.


8.jpg



Now try to test the site without ‘https’ and you will get an error as shown below….That means your certificate is working.


9.jpg




Do not forget to enable IIS anonymous access.

Step 5:- Consume the service in a web application

It’s time to consume the service application in ASP.NET web. So click on add service reference and specify your service URL. You will shown a warning box as shown in the below figure. When we used makecert.exe we did not specify the host name as the service URL. So just let it go.

10.jpg


Step 6:- Suppress the HTTPS errors

‘makecert.exe’ creates test certificates. In other words it’s not signed by CA. So we need to suppress those errors in our ASP.NET client consumer. So we have created a function called as ‘IgnoreCertificateErrorHandler’ which return true even if there are errors. This function is attached as a callback to ‘ServicePointManager.ServerCertificateValidationCallback’.

In the same code you can also see service consuming code which calls the ‘GetData’ function.

 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebApplicationConsumer.ServiceReference1; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; namespace WebApplicationConsumer { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(IgnoreCertificateErrorHandler); Service1Client obj = new Service1Client(); Response.Write(obj.GetData(12)); } public static bool IgnoreCertificateErrorHandler(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } } } 


Step 7:- Enjoy success

Now to the easiest step, compile you ASP.NET client and enjoy success.

11-copy-1.jpg

Can you show a simple example of message level security ?

Let’s do a simple example of message security using Wshttp with X509 certificates.

Step 1:- Create client and server certificates

Create two certificates one for the server and the other for the client using makecert.exe. You can get makecert.exe from “C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\Bin” folder. So you can goto dos prompt and run the below command snippet.

makecert.exe -sr CurrentUser -ss My -a sha1 -n CN=WCfServer -sky exchange -pe
makecert.exe -sr CurrentUser -ss My -a sha1 -n CN=WcfClient -sky exchange -pe
 

Below is a detailed explanation of various attributes specified in the ‘makecert.exe’.


Attribute

Explanation

-sr

Specifies the registry location of the certificate store. The SubjectCertStoreLocation argument must be either of the following:
currentUser
Specifies the registry location HKEY_CURRENT_USER.
localMachine
Specifies the registry location HKEY_LOCAL_MACHINE.

-ss

Specifies the name of the certificate store where the generated certificate is saved.

-a

Specifies the algorithm. Can be either MD5 or SHA1.

-n

Specifies a name for the certificate. This name must conform to the X.500 standard. The simplest method is to use the "CN=MyName" format.If the /n switch is not specified; the default name of the certificate is "Joe's Software Emporium".

-sky

Specifies how will be the key type. Can be either exchange or signature.

-pe

This makes the key exportable.




Note: - Makecert.exe is a free tool provided by Microsoft which helps to create X.509 certificate that is signed by a system test root key or by another specified key. This is a test certificate and not a real one and should not be used for production purpose. For production buy proper certificates from Thawte, Verisign, GeoTrust etc.
 

Currently we have specified that we want to create the client key with ‘WcfClient’ name and server key with ‘WCFServer’. The certificates should be created for the current user and should be exportable.


Once you run the command you should see the ‘Succeeded’ message as shown in the below figure. Below figure shows keys created for both server and client.



12.jpg


Step 2 :- Copy the certificates in trusted people certificates

Go to start à run and type MMC and press enter. You will be popped with the MMC console. Click on file à Add/remove snap-in.


13-copy-1.jpg



ou will be popped up with a Add/Remove Snap-in , click on the add button , select certificates and select ‘My user Account’.
You can see the certificates created for client and server in the personal certificates folder. We need to copy those certificates in trusted people à certificates folder.


14.jpg



Step 3 :- Specify the certification path and mode in the WCF service web.config file

Now that we have created both the certificates we need to refer these certificates in our WCF project.
So we have created two projects one which has the WCF service and the other project is a web application which will consume the WCF service.


15.jpg



Let’s open the web.config file of the WCF service and enter two important things:-
• Where the certificate is stored, location and how WCF application should find the same. This is defined using ‘serviceCertificate’ tag as shown in the below snippet.
• The ‘certificationvalidationmode’ defines how client certificates will be authenticated.


Certification validation mode

Description

Chain trust

In this situation the client certificate is validated against the root certificate.

Peer trust

PeerTrust ensures that the public key portion of the certificate is in the Trusted People certificate folder on the clients computer

ChainORPeertrust

This is just a OR condition for both chain and peer.




The above two points is clubbed together and entered in the web.config file of the WCF service.

 <serviceCredentials> <clientCertificate> <authentication certificateValidationMode="PeerTrust"/> </clientCertificate> <serviceCertificate findValue="WCfServer" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" /> </serviceCredentials> 

Step 4 :- Define bindings

Now that we have defined our certificates and authentication type we need to define that the authentication values will be sent through message using certificates. You can see we have defined the ‘WsHttpBinding’ with message attribute specifying that the WCF client needs to send a certificate for validation.

 <bindings> <wsHttpBinding> <binding name="wsHttpEndpointBinding"> <security> <message clientCredentialType="Certificate" /> </security> </binding> </wsHttpBinding> </bindings> 

Step5 :- Tie up the bindings with end point

Once done we need to tie up this binding with the end point. This is done by using ‘bindingConfiguration’ tag as shown in the below code snippet.

 <endpoint address="" binding="wsHttpBinding" "BACKGROUND-COLOR: #ffff00">bindingConfiguration"BACKGROUND-COLOR: #ffff00">="wsHttpEndpointBinding" contract="WCFServiceCertificate.IService1"> 

Step 6 :- Make your web application client for consuming the WCF service

That’s all we need to from the WCF service perspective. So compile the WCF service and reference the same in the ASP.NET web application using ‘Service reference’. Below is the code snippet where we have referenced the service and called the ‘GetData’ function of the service/

 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; "BACKGROUND-COLOR: #ffff00">using WebConsumer.ServiceReference1; namespace WebConsumer { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { "BACKGROUND-COLOR: #ffff00">Service1Client obj = new Service1Client(); 
 "BACKGROUND-COLOR: #ffff00">Response.Write(obj.GetData(12)); } } } 

Now if you try to run the client i.e. the web application as it is you should get an error as shown below. The error clearly indicates you can use the WCF service until you do not provide the client certificate.


16.jpg

Step 7 :- Define certificates in WCF client

So let’s start the process of defining certificates in the WCF client. The way we have defined authentication certification mode and the path of the certificate, in the same way we need to define it for WCF client. You can see we have defined the authentication mode as ‘peertrust’ and we have specified the client certificate name as ‘WcfClient’.

 <behaviors> <endpointBehaviors> <behavior name="CustomBehavior"> <clientCredentials> <clientCertificate findValue="WcfClient" x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="My" /> <serviceCertificate> <authentication certificateValidationMode="PeerTrust"/> </serviceCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> 

Step 8 :- Tie up the behavior with end point on WCF client

We need to tie up the above defined behavior with the end point. You can see we have bounded the behavior using ‘behaviorConfiguration’ property. We also need to specify that the DNS value will be ‘WcfServer’ which your server certificate name.

 <client> <endpoint address="http://localhost:1387/Service1.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1" name="WSHttpBinding_IService1" "BACKGROUND-COLOR: #ffff00">behaviorConfiguration="CustomBehavior"> <identity> "BACKGROUND-COLOR: #ffff00"><dns value="WcfServer" /> </identity> </endpoint> </client> 

Step 9 :- Enjoy your hard work

Once we are done you can run the ASP.NET web and you should see the below display.

17.jpg




What is the difference between BasicHttpBinding and WsHttpBinding ?

If we want to summarize in one sentence the difference between ‘WsHttpBinding’ and ‘BasicHttpBinding’ is tha ‘WsHttpBinding’ supports ‘WS-*’ specification. WS-* specifications are nothing but standards to extend web service capabilities.

Below is a detailed comparison table between both the entities from security, compatibility, reliability and SOAP version perspective.


Criteria

BasicHttpBinding

WsHttpBinding

Security support

This supports the old ASMX style i.e WS-BasicProfile 1.1.

This exposes web services using WS-* specifications.

Compatibility

This is aimed for clients who do not have .Net 3.0 installed and it supports wider ranges of client. Many of clients like Windows 2000 still do not run .NET 3.0. So older version of .NET can consume this service.

As its built using WS-* specifications it does not support wider ranges of client and it cannot be consumed by older .NET version less than 3 version.

Soap version

SOAP 1.1

SOAP 1.2 and WS-Addressing specification.

Reliable messaging

Not supported. In other words if a client fires two or three calls you really do not know they will return back in the same order.

Supported as it supports WS-* specifications.

Default security options

By default there is not security provided for messages when the client calls happen. In other words data is sent as plain text.

As WsHttBinding supports WS-* it has WS-Security enabled by default. So the data is not sent in plain text.

Security options

  • None
  • Windows – default authentication.
  • Basic
  • Certificate
  • None
  • Transport.
  • Message.
  • Transport with message credentials.




One of the biggest differences you must have noticed is the security aspect. By default ‘BasicHttpBinding’ sends data in plain text while ‘WsHttpBinding’ sends in encrypted and secured manner. To demonstrate the same let’s make two services one using ‘BasicHttpBinding’ and the other using ‘WsHttpBinding’ and then let’s see the security aspect in a more detailed manner.

We will do a small sample to see how ‘BasicHttpBinding’ sends data in plain text format and how ‘WsHttpBinding’ encrypts data.

Note :- By Default security is not enabled on ‘BasicHttpBinding’ for interoperability purpose. In other words it like our old webservice i.e. ASMX. But that does not mean we cannot enable security in ‘BasicHttpBinding’. Sometimes back we had a written a article on how to enable security on ‘BasicHttpBinding’ WCFBasicHttpBinding.aspx
 

Can you show the security differences between BasicHttpBinding VS WsHttpBinding ?

In order to understand the security differences between both these entities we will do a small project. In this project we will create two WCF service one service using ‘BasicHttpBinding’ and the second service using ‘WsHttpBinding’.


18.jpg



Step1:-
So let’s first create a simple service using ‘BasicHttpBinding’. For that we just a create a simple WCF project and then modify the ‘ServiceModel’ element as shown below. You can see in the ‘endpoint’ tag we have specified ‘basicHttpBinding’ as the protocol.

 <system.serviceModel> <services> <service name="WCFBasicHttpBinding.Service1" behaviorConfiguration="WCFBasicHttpBinding.Service1Behavior"> <!-- Service Endpoints --> <endpoint address="" binding="basicHttpBinding" contract="WCFBasicHttpBinding.IService1"> <!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically. --> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="WCFBasicHttpBinding.Service1Behavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 



Step 2 :-
We also need to create one more service using ‘WsHttpBinding’. For that you do not need to anything special as such. By default WCF project is created using ‘WsHttpBinding’. Below is how the Web.config file looks like. You can see how the endpoint tag is using ‘wsHttpBinding’.

 <system.serviceModel> <services> <service name="WCFWsHttpBindingHttps.Service1" behaviorConfiguration="WCFWsHttpBindingHttps.Service1Behavior"> <!-- Service Endpoints --> <endpoint address="" binding="wsHttpBinding" contract="WCFWsHttpBindingHttps.IService1"> <!-- Upon deployment, the following identity element should be removed or replaced to reflect the identity under which the deployed service runs. If removed, WCF will infer an appropriate identity automatically. --> <identity> <dns value="localhost"/> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="WCFWsHttpBindingHttps.Service1Behavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 




Step 3 :-
We will not be creating any new methods in both the services. We will just use the default code created by the WCF template. So both these services will have a ‘GetData’ function which returns a string. The ‘GetData’ function is a default function created WCF project.

 public class Service1 : IService1 { public string GetData(int value) { return string.Format("You entered: {0}", value); } public CompositeType GetDataUsingDataContract(CompositeType composite) { if (composite.BoolValue) { composite.StringValue += "Suffix"; } return composite; } } 


Step 4 :-
Now that out services are created we need to create a client which will consume this service. So we have created a simple web application and we have added two references one is a service reference i.e. ‘WsHttpBinding’ and the second is a web reference i.e. ‘BasicHttpBinding’. Please note when you right click to add reference you need to use the ‘Add service reference’ to add ‘WsHttpService’ and you need to add web reference for ‘BasicHttpBinding’.


19.jpg



We will add two buttons on the default aspx page. One button will call the http service and the other will call the wshttp service. Below is how the function ‘GetData’ is called in both the button clicks.

20.jpg



Step 5 :- So now we are ready with the complete project it is time to sniff and see how data is transported between client and the service in both the scenarios. So let’s download a simple http data recorder from http://www.ieinspector.com/httpanalyzer/download.html  . We will then click both the buttons one by one and record the data transfer using httpanalyzer. You can see the posted data is in simple plain XML format for basic http protocol and it’s in an encrypted format for wshttp protocol.


21.jpg





When should we use WsHttp as compared to BasicHttp ?

If you are looking for back ward compatibility and to support lot of clients then basic http binding is the way to go or else WsHttp is the great way to start if you are seeing your clients made in .NET 3.0 and above.

How can we enable windows authentication on WCF using ‘BasicHttpBinding’?

 

Step 1:- Create a project of WCF service application as shown in the below figure.

22.jpg


Circle WCF service application àSelect this
 

By default the WCF project creates a class file which has ‘GetData’ function. This function takes in a number values and displays a explanatory sentence like ‘You entered 1 value’ , in case you have entered ‘1’.

 public class Service1 : IService1 { public string GetData(int value) { return string.Format("You entered: {0}", value); } } 

Step 2:- When we create a WCF service application it also has a web.config file associated with it. So open the web.config file and ensure that authentication mode is windows.

 <authentication mode="Windows" /> 

Step 3:- The third step is to define the bindings and the transport type. To define the bindings we need to enter ‘basicHttpBinding’ element inside the ‘bindings’ XML tag. We also need to define the ‘clientCredentialType’ as windows.

 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpEndpointBinding"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> </security> </binding> </basicHttpBinding> </bindings> <services> ......... ......... </system.serviceModel> 

Step 4:- Now the bindings defined needs to be associated with service interface i.e. ‘service1’. So we need to modify the services elements as shown below. You can note that we have defined a end point which has the binding association.

 <system.serviceModel> ........ ........ ........ <services> <service behaviorConfiguration="WCFWindowsBasicHttpBinding.Service1Behavior" name="WCFWindowsBasicHttpBinding.Service1"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding" name="BasicHttpEndpoint" contract="WCFWindowsBasicHttpBinding.IService1"> <identity> <dns value="localhost" /> </identity> </endpoint> </service> </services> ......... ......... ......... ......... </system.serviceModel> 

So over all your <system.serviceModel> XML part as whole with bindings and services is a shown below.

 <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpEndpointBinding"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" /> </security> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="WCFWindowsBasicHttpBinding.Service1Behavior" name="WCFWindowsBasicHttpBinding.Service1"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding" name="BasicHttpEndpoint" contract="WCFWindowsBasicHttpBinding.IService1"> <identity> <dns value="localhost" /> </identity> </endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="WCFWindowsBasicHttpBinding.Service1Behavior"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true"/> <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 

Step 5 :- Go to IIS properties and click on security tab and ensure that anonymous access is disabled and only windows authentication is enabled.


23.jpg

 

 

Step 6:- We need to host our service in the IIS. So make the directory as an IIS application so that your service can be hosted. Now if you try to browse the service i.e. the SVC file you will see that it pops up the authentication authorization security dialog box. So this service cannot be executed with windows authentication.

 

 

24.jpg

 

 

Step 7:- So let’s consume this WCF services. So add an ASP.NET webapplication and do a add webreference. You will be popped up with a dialog box as shown below. Click on add reference so that a proxy is generated for the WCF service.

 

 

 

25.jpg

 

 

Step 8:- Type in the following code snippet in your page load. So add the namespace reference and call the method ‘GetData’. The most important step to note is the credential supplied. ‘DefaultCredentials’ passes the current windows identity to the WCF service.

 

 

 

26.jpg

 

 

 

If you execute the service you should get the following display as shown below.

 

 

 

27.jpg

 

 

You can try commenting the below code in your client in other words we are not passing any credentials.

 obj.Credentials = System.Net.CredentialCache.DefaultCredentials; 

Now if you execute you should get the below error stating that this is a unauthorized call.

 

 

 

28.jpg

Source Code

Whatever code we have discussed in the above FAQ can be downloaded from http://www.codeproject.com/KB/WCF/WCFFAQPart3/WCFSourceCode.zip

Share this post

Repost 0
Published by Shivprasad koirala
write a comment

comments

Important .NET and C# interview questions and answers

.Net interview questions: - Explain why it is not preferred to use finalize for clean up?

.Net interview questions: - Show the five levels in CMMI?

.NET interview questions and answers: – Which is the best place to store connection string in .NET projects?

C# interview questions and answers: – Explain the use of Icomparable in c#?

C# interview questions: - How can we check which rows have changed since dataset was loaded?

C# interview questions and answers: - Can you write a simple c# code to display Fibonacci series?

.NET interview questions and answers: - What is difference betweenIcomparable VS Icomparer ?

C# and .NET interview question: -What is short circuiting in C#?

C# and .NET interview question: - What are symmetric and asymmetric algorithms?

Important c# and .NET interview question on object pooling and Gridview events?

.NETinterview questions and answers: – Will the finally run in this code?

How to prepare for c# and .NETinterviews?

C# and .NET Interview questions: - What is Thread.Join () in threading?

.NET Interview questions and answers: -What is serialization and deserialization in .NET?

C# and .NET interview question: - What is hashing?

c# and .NET interview question:- what connects dataset and data source ?

.Net interview questions and answers: - What is the difference between “Web.config” and “Machine.Config”?

.NET interview questions and answers: - What is TPL?

.NET Interview questions and answers: -What are different access modifiers?

.NET and c# Interview Question and answers: – If we want to update interface with new methods, what is the best practice?

 MVC ( Model view controller) interview questions and answers      

ASP.NET Application and Page Life Cycle 

12 Important FAQ’s on VSTS Testing (Unit testing, load testing, automated testing, database testing and code coverage) 

 6 important use of Partial/Mock testing

6 important uses of Delegates and Events

7 Simple Steps to Run Your First Azure Blob Program

8 Steps to Create Workflows using SharePoint Designer

Azure FAQ Part 1

C# Code Reviews using StyleCop – Detailed Article

Four real world uses of Partial classes and Partial methods

SharePoint Quick Start FAQ Part 1

SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows

SharePoint Workflow Basics

 

 

 

 

MVC Interview questions videos

Viewdata,viewbag,tempdata

 

MVC asynch controllers

What is View Model in ASP.NET MVC?



ADO.NET interview questions videos



Explain ADO.NET Connection pooling

 

 

Windows Phone Application Questions Videos

 

How to create a simple windows phone application ?

 

 

MVC Interview questions and answers Article

 

(Model view controller)MVC Interview questions and answers

MVC interview questions with answers video: – What is Web API how to implement the same?

ASP.Net MVC  4 interview questions with answers: - What is Bundling and minification in Model view controller ?

MVC interview questions with answers :- Is it possible to return values instead of Actionresults?

MVC interview questions with answers :- What are the actionresults available in MVC?

MVC interview questions with answers:-Html.PartialvsHtml.RenderPartialvsHtml.RenderPage in MVC

MVC ASP.NET INTERVIEW QUESTIONS WITH ANSWERS :- WHAT IS THE DIFFERENCE BETWEEN VIEWSTATE VS VIEWDATA ?

MVC vs ASP.NET ( MVC Interview question with answers )?

How can we detect that a MVC controller is called by POST or GET ? ( ASP.NET MVC Interview questions with answers)

What are the different ways by which you will get Form Data in controller? ( MVC Interview questions with answers)

What is the difference between Presenter and Controller in MVC?(MVC interview questions with answers)

Learn MVC (Model view controller) Step by Step in 7 days – Day 4

MVC Interview questions and answers PDF

MVC interview questions with answers

ActionResult vs. View() vs. ViewResult :- MVC interview questions with answers

Explain Areas in MVC?( MVC interview questions with answers)

Can you explain the purpose of ViewModel in MVC?( ASP.NET MVC Interview questions with answers)

ASP.NET MVC interview questions: - What are Filters in MVC?

What are areas in MVC?( MVC Interview questions with answers)

Explain the concept of View Model in MVC?

Exception Handling in MVC

Explain MVC application life cycle?


100 MVC Interview question PDF download released , Enjoy


Learn Microsoft Business intelligence step by step – Day 1


Can you create TempBag just like ViewBag?( MVC Interview questions)


MVC Unit Testing Unleashed

MVC and .NET learning tutorials for components of MVC and how do you perform unit testing in MVC?

Explain MVC model binders ? ( ASP.NET MVC interview questions)

Explain the difference between layout and master pages ? (MVC Razor interview questions)

Advantages of ViewModel in MVC(Model View Controller)

Difference Between ViewResult() and ActionResult() in MVC ?

What is the difference between each version of MVC 2, 3, 4, 5 and 6? (MVC Interview Questions)

Learn ASP.NET MVC 5 Step by Step in 30 days – Day 1

Can we overload MVC controller action methods ? (MVC Polymorphism) 

Can we overload Actions / Controllers in MVC? (MVC Interview questions)

 


WCF Interview questions videos

 

overloading in WCF

WCF fault exceptions ?

 

 

 

 

WPF Interview question with answers videos

 

Why WPF and compare WPF with Winforms ?

 

 

C# Interview Questions & Answers Article

 

12 Important FAQ’s on VSTS Testing (Unit testing, load testing, automated testing, database testing and code coverage)

6 important use of Partial/Mock testing

6 important uses of Delegates and Events

7 Simple Steps to Run Your First Azure Blob Program

8 Steps to Create Workflows using SharePoint Designer

Azure FAQ Part 1

C# Code Reviews using StyleCop – Detailed Article

Four real world uses of Partial classes and Partial methods

SharePoint Quick Start FAQ Part 1

SharePoint Quick Start FAQ Part 6 – Workflows, Workflows and Workflows

SharePoint Workflow Basics

C# (Csharp) interview questions and answers: – What are indexers in .NET?

C# OOP interview questions and answers: - I do not want to implement all the interface methods?

C# design pattern (UNIT of Work Design Pattern)

C# design pattern interview questions – What is Dependency injection ?

C# interview questions and answers: - What is the difference between “==” and .Equals()?

How questions are asked in c# interviews?

C# design pattern interview question: - DI vs IOC

8 important C# Interview questions on IL code, JIT, CLR, CTS, CLS and CAS

What is the difference between Reflection and Dynamic in C#?

C# and .NET interview question: – When should we use Structure as compared to classes
?

C# REST interview questions with answers asked in Polaris Hydrebad

c# threading interview questions :- Parallel.ForEach vs Task.Factory.StartNew

C# circular dependency interview questions with answers.

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

C# and .NET interview questions with answers: - How can we mark a method as deprecated?

C# INTERVIEW QUESTIONS WITH ANSWERS: - HOW TO ASSIGN MULTILINE STRING IN VISUAL STUDIO?

What is cyclomatic complexity (C# testing interview questions with answers)?

Define code coverage? (C# unit testing interview questions with answers)

Can you talk about Abstraction and Encapsulation in detail ? ( .NET, c# and OOP interview questions with answers )

Can you explain a practical example of virtual and Override? ( C# OOP interview questions with answers )

Can you explain class and object in real time scenario? ( C# and .NET OOP Interview questions with answers)

What is code digger ? ( C# visual studio interview questions with answers)

C# Lazy loading interview questions with answers

What is eager loading in c# ( C# eager loading interview questions with answers)?

Can you explain the term concurrency? (C# Interview questions with answers)

10 important C# Constructor and destructor interview questions

3 important c# Partial class interview questions with answers

Change Functionality without changing function( C# Architecture interview question with answers)?

What is ENUM and what are the benefits of using it (ENUM C# Interview Question 1)?

How can we loop through ENUM values( C# ENUM Interview questions with answers)?

What is the difference between Connection Timeout and Command Timeout?( C# ADO.NET Interview questions with answers)

How you differentiate Shadowing with Overriding? (C# overriding interview questions)

C# date and time interview question with answers

Explain the difference between early binding and late binding? ( C# interview questions with answers)

How can we restrict types in generics ?( C# generic interview questions)

What are generics, Delegates and Generic delegates ( C# interview questions)?

How can we convert JSON string in to c# object?(  C# JSON interview questions)

C# and .NET interview questions asked in TCSwalkin.

C# and .NET interview questions on Coalescing operator.

String vs string ( C# interview questions with answers)

Explain SOLID principles (C# Architecture interview questions)?

C# and .NET interview questions around Read only and Constant

C# Architecture interview questions with answers

C# Mock testing interview questions and answers: – What is Mock testing and how can we implement Mocking?

Write a simple regex for email validation? (C# interview questions with answers)


C#.NET interview questions: - What is the use of “Yield” keyword? Mention atleast one practical scenario where it can be used?

C#.NET interview questions: - What is the difference between Build Vs Rebuild Vs Clean solution menu? What is the difference “Rebuild” and if you do “Clean” + “Build”?

C# and .NET interview questions around JIT and NGEN


What is the difference between throw vs throw ex ?( C# Interview questions with answers)

C#/.NET interview questions: - What are the steps included to get a collection of records from database in C#?


Learn C# in Hindi video tutorials


QuestPond’s real life examples on Extension methods and nullable types in C#.NET


Why Microsoft has partial classes and Java does not?

 

 

 

WCF INTERVIEW QUESTIONS AND ANSWERS ARTICLE

 

 

WCF INTERVIEW QUESTIONS AND ANSWERS: - WHAT IS THE DIFFERENCE BETWEEN SERVICE ENDPOINT AND CLIENT ENDPOINT

 

WCF INTERVIEW QUESTIONS WITH ANSWERS: - WCF REST VS. WEB API

 

WCF INTERVIEW QUESTIONS WITH ANSWERS :- CAN WE HAVE METHOD OVERLOADING WHILE DEFINING WCF SERVICE OPERATIONS ?

 

WCF INTERVIEW QUESTIONS WITH ANSWERS :- WHAT IS DATACONTRACTSERIALIZER AND HOW IT’S DIFFERENT FROM XMLSERIALIZER 

What is SOA and what is WCF? ( WCF interview questions with answers)

Six important WCF interview questions with answers

6 important WCF Instancing interview questions with answers

WCF Service metadata interview questions with answers

7 WCF SOA interview questions with answers

What are the various ways of consuming WCF services?(WCF C# interview questions with answers)

What is the difference between Serialization and Encoding in WCF?( WCF interview questions with answers)

Why returning dataset or data table from WCF service is not a good practice?(WCF service interview questions with answers)

WCF transaction interview questions: - How transaction works in WCF?

WCF Transaction interview questions.

.NET WCF(Windows Communication Foundation) interview questions: - Distinguish between Web Services and Remoting | WCF and Web services

WCF interview questions: - What exactly do you mean by Single in WCF instancing? How to set and what is by default set value of instance context mode?

Explain WCF Duplex services? ( WCF Interview questions)

QuestPond: Interview Questions and Answers on learning WCF

WCF Interview Questions: - What are the different ways of doing WCF concurrency and WCF instancing?

QuestPond: Interview Questions and Answers on learning WCF (Windows Communication Foundation)

QuestPond: Interview Questions and Answers on learning WCF (Windows Communication Foundation)

QuestPond: Interview Questions and Answers on WCF(Windows Communication Foundation)

QuestPond: Interview Questions and Answers on learning WCF (Windows Communication Foundation)

QuestPond’s Interview Questions & Answers on learning data contract serializer and XML serializer

QuestPond’s Interview Questions & Answers on learning serialization events

QuestPond’s Interview Questions & Answers on learning WCF(Windows Communication Foundation)

QuestPond’s Interview Questions & Answers on WCF(Windows Communication Foundation)


QuestPond’s Interview Questions & Answers on WCF(Windows Communication Foundation)

QuestPond’s Interview Questions & Answers on WCF (Windows Communication Foundation)


QuestPond’s Interview Questions & Answers on WCF (Windows Communication Foundation)

 

 

 

WPF Interview Questions And Answers Article

 

 

6 IMPORTANT WPF AND SILVERLIGHT MULTI-THREADING INTERVIEW QUESTIONS WITH ANSWERS

 

C# WPF INTERVIEW QUESTIONS::- WHAT ARE DEPENDENCY PROPERTIES ?

 

WPF INTERVIEW QUESTIONS WITH ANSWERS: – WHAT ARE WPF CONVERTERS?

 

WPF INTERVIEW QUESTIONS ON EVENTS (TUNNELING, BUBBLING AND DIRECT)

 

What are the advantages of using WPF ( WPF interview questions with answers)?

 

Explain WPF bindings?( .Net WPF Binding interview questions)

 

WPF Interview questions with answers :-What is XAML in WPF and why do we need it?

 

What are the different kinds of controls in WPF?(C# WPF Interview questions with answers)

 

Can you explain the complete WPF object hierarchy?(WPF Interview questions with answers)

How does “UpdateSourceTrigger” affect bindings?( C# WPF interview questions with answers)

WPF Interview questions :- Which are the different namespaces and classes in WPF ?

What are resources in WPF? (C# WPF Interview questions with answers)

Explain multi binding and multivalue converters? (.NET WPF  Interview questions with answers)

Explain the difference between static and dynamicresource? (.NET WPF interview questions)

18 important WPF interview questions asked in WPF interviews.

.NET WPF(Windows Presentation Foundation) interview questions: - What is WPF? What are the advantages of WPF over Winforms?

Explain WPF relative binding / relative resource? (.NET WPF Interview questions with answers)

Explain Ancestor relative source binding in WPF ? ( WPF Interview questions with answers)

Explain the need of binding and commands?(WPF Interview questions)

Can you explain WPF command with an example? ( WPF Interview questions with answers)

Explain the need of “INotifyPropertyChanged” interface? ( C# WPF Interview questions with answers)

What is MVVM? (WPF MVVM Interview questions)

What is the importance of command and bindings in MVVM pattern? ( WPF MVVM Interview questions)

What is the difference between MVVM and 3 layer architecture? ( WPF  MVVM Interview questions with answers)

Explain delegate command? (WPF MVVM interview questions)

WPF Interview questions with answers

Explain WPF styles?(C# WPF Interview questions with answers)

Explain Multitrigger concept in WPF?( C# WPF Interview questions with answers)

How are WPF observable collections different from simple .NET collections? (.NET WPF Interview questions)

What is the difference between control templates and data templates? ( .NET WPF Interview questions)

What are various ways of doing alignment in WPF?( WPF Interview questions with answers)

 

Algorithm Interview Questions


Algorithm interview questions and answers: – Can you write code for bubble sort algorithm?

Algorithm interview questions and answers: – What is inserted sort algorithm?

SQL INTERVIEW QUESTIONS & ANSWERS ARTICLE

 

SQL Server Interview Questions & Answers Article

SQL Server interview questions and answers: - What is HID data type in SQL Server ?

SQL Server interview questions with answers: – How to get the top record without using max, top and order by keyword?

SQL Server interview questions with answers :- If you wish to store financial values which SQL Server data type is more suitable ?

SQL Server interview questions and answers: – What is the difference between Candidate Key, Primary Key, and Alternate Key

SQL Server interview questions with answers :- What are Indexes in Sql Server?

How to sort interactively using SSRS? (SQL Server reporting services interview questions)

How to do conditional formatting in SSRS? (SQL Server reporting services interview questions with answers)

WHAT IS NORMALIZATION AND EXPLAIN 1NF 2NF AND 3NF IN SIMPLE WORDS? SQL SERVER INTERVIEW QUESTIONS WITH ANSWERS

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

 

When you will use inner join and when you will use outer join? SQL Server interview questions with answers

 

Do you know anything about Temporary procedures in SQL?( SQL Server interview questions with answers)

 

4 SQL Server interview questions with answers on TempTb

 

Are full outer join and Cross join are same? ( SQL Server interview questions with answers)

 

Delete duplicate records: - SQL Server interview questions with answers

 

4 most asked  SQL queries during SQL Serverinterview’s

 

How Temporary tables are different from normal tables and what are its types ?( SQL Server interview questions with answers)

 

SQL Server interview Questions on JOIN’s

 

SQL Server interview questions: - How can you increase SQL performance?

 

SQL Server interview questions: - What problem you face if locking is not implemented?

 

Can we insert NULL’s in to UNIQUE key ? ( SQL Server  interview questions with answers)

 

Explain Normalization?(SQL Server Interview questions with answers)

Temp variablesVS Temp tables(SQL Server interview questions)

 


 




.NET INTERVIEW QUESTIONS & ANSWERS ARTICLE

 

.NET interview questions and answers: - How to reverse a string in .NET ( DotNet)?

.NET interview questions and answers: - What is the use of Click Once?

.NET interview questions and answers: - Will the below codes create new instances?

C# and .NET interview questions with answers – What is Nuget?

Dependency injection (DI) VS Inversion of Control (IOC)

.NET interview questions with answers: - What is the difference between Reflection and Dynamic?

Five Great .NET Framework 4.5 Features

ASP.NET MVC 4 interview questions with answers: - What is the use of “AllowHTML” and “ValidateInput” attributes?

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

.NET interview questions with answers: – Can we use events without delegates ?

.Net Interview question Edition 6 is available now.

.NET interview questions with answers: – What’s the difference between catch with parameter and catch without parameter?

.NET interview questions : - What is the use and difference between “IS” and “AS” keyword?

.NET interview questions with answers: - Build solution VS Rebuild solution VS Clean solution

HTML 5 interview questions with answers for LocalStorage and SessionStorage

.NET 4.0 interview questions with answers: – What are code contracts?

What are portable class libraries? ( .NET interview questions with answers)

How to loop through ENUM using C# (.NET interview questions with answers)?

What are transactions in C#? (.NET interview questions with answers)

What are ACID Properties( .NET Interview questions with answers)?

.NET interview questions: – What are the areas that need to be concentrated for senior(9+ years experience)persons in .NET technologies?

.NET interview questions: - Explain real time scenarios in Factory Pattern, Abstract Pattern, Singleton, WCF and REST services

What is the difference between IS A and Can a Relationship?( .NET Interview questions with answers)

What is the use of ENUM Flags(.NET Enum Interview question 2)?

What is the difference between .Net,C#, Asp.net, Asp.net Web Forms and Asp.net MVC and MVC?( C# and ASP.NET Interview questions)

ADO.NET interview questions: - Explain in detail the fundamental of connection pooling?

.NET interview questions: – Can you explain generics in .NET?

What are Properties and methods ? ( .NET OOP Interview questions with answers)

What’s the first step you take for implementing any of Design Pattern?( .NET  Design pattern interview questions with answers)

.NET interview questions: - What are different types of JIT?

ADO.NET Interview Question: - What are the major differences between classic ADO and ADO.NET?

.NET interview questions: – What is the difference between Reflection and Dynamic?

What is the Use of interfaces?( .NET Interview questions with answers)

.NET interview questions: - What role did you play in your project and company?

Visual studio 2012 Fakes

.NET interview questions: - So how can we clean unmanaged objects and also maintain performance?

ADO.NET Interview Questions: - What are basic methods of Data adapter?

.NET interview questions: - What are system level exceptions and application level exceptions?

.NET interview questions: - What is UML and which are the important diagrams?

.NET interview questions: - What is time out support in regex (regular expression)?

.NET interview questions: - How can we improve performance of .NET?

.NET interview questions: - Can you explain the concept of “Short Circuiting”?

.NET interview questions: - Can you explain Forms authentication in detail?

What is the difference between VAR and Dynamic keyword? ( .NET Interview questions with answers)

.NET interview questions: - What are similarities and difference between Class and structure?

Can you compare String.IsNullOrEmpty vs String.IsNullOrWhiteSpace ? ( .Net Interview questions with answers)

.NET interview questions: - Distinguish between Reflection and Dynamic?

.NET interview questions: - In which scenarios we can use serialization and when to use what binary serialization or XML serialization?

.NET interview questions: - Are there any readymade objects in .NET by which we can implement Lazy loading?

.NET interview questions: - What are different access modifiers?

ADO.NET interview questions: - Explain in detail the fundamental of connection pooling how to enable and disable connection pooling?

ADO.NET interview questions: - What is the namespace in which .NET has the data functionality class?

ADO.NET interview questions: - What are the different components in ADO.NET?

ADO.NET interview questions: - Show difference between “Optimistic” and “Pessimistic” locking and how many ways are there to implement optimistic locking in ADO.NET?

.NET interview questions: - Does code contract only do dynamic checks?

ADO.NET interview questions: - How can we fire a simple SQL Statement using ADO.NET?

.NET interview questions: - What basic steps are needed to display a simple report in crystal?

ADO.NET interview questions: - What are basic methods of Data adapter and mention the use of data adapter?

.NET interview questions: - What is UML? How many types of diagrams are there in UML?

.Net Interview Questions - What is MVC, MVP and MVVM pattern?

.NET interview questions: - How can you define a property read only for external world and writable in the same assembly?

Explain the implicit and explicit conversion of data types with examples?( .NET interview questions on data type)

.NET interview questions: - What is Reflection its implementation and practical uses?

What is downcasting and upcasting? (.NET interview questions with answers)

.NET interview questions: - How to decide on the design consideration to take a Data grid, data list or repeater?

.NET interview questions: - If we want to update interface with new methods, what is the best practice?

.NET interview questions: - How does selection sort algorithm works?

XML(.NET) interview questions: - What is XML?

.NET Interview questions: - If a validation is very complex what will you do?

.NET interview questions: - How can we stop the class from further inheriting?

XML (.NET) Interview questions :- Explain simple Walk through of XmlReader.

.NET interview questions : - How can we improve performance of .NET and show the difference between .NET 1.X, 2.0, 3.0, 3.5 and 4.0?

How to convert string to ENUM value ?( .NET interview questions with answers)

.NET architecture interview questions series: - What is mean by modeling language?

.NET architecture interview questions : - What are benefits and Limitation of using Viewstate, hidden frames and Cookies?

.NET interview questions: - What is GAC (Global Assembly Cache)?

.NET interview questions: - Explain Nuget?

.NET Testing interview questions: - What is the difference between Unit testing, Assembly testing and Regression testing?


.NET interview questions: - What is Code Access Security (CAS) and how does it work? Is CAS supported in .NET 4.0?


.NET interview questions: - What are the advantages /disadvantages of lazy loading?


.NET interview questions: - What is the use of DEBUG directive?


.NET testing interview questions: - What is Mock testing and how to implement it?


.NET interview questions: - What is the difference between DEBUG and Release?


.NET testing interview questions: - How can we UNIT test private methods using VSTS? Is it good to practice to UNIT test Private methods?


Explain 3 layer architecture ( .NET Interview questions)?


.NET interview questions : - What is a delegate and how can we create a delegate? What is a multicast delegate?


ADO.NET interview questions: - How to add/remove row is in “Data Table” object of “Dataset”? How to load multiple tables in a Dataset & adding relation between tables in a Dataset?


What is the difference between Array, ArrayList and List?( .Net Interview questions)

.NET interview questions: - How to implement DTC in .NET?
.NET interview questions: - What is an Interface and what are abstract classes

.NET interview questions: - Interface vs. abstract class

.NET interview questions: - How to implement practically Lazy loading in .NET?


.NET interview questions: - How can we handle exceptions in .NET? What if we do not catch the exception?

.NET interview questions based on Projects.


.NET interview questions: - What is shadowing? What is the difference between Shadowing and Overriding?

.NET interview questions: - All about Design Patterns in .NET


.NET interview questions: - How can we improve performance of .NET/ASP.NET/SQL Server?

.NET interview questions: - What benefits does sealed keyword provide?


.NET Architecture UML interview question


.NET interview questions: - How to maintain performance and can clean unmanaged objects?


.NET interview questions: - Explain ENUM and its benefits? What is the use of Flagsin ENUM?

.NET interview questions: - How to create a windows service using .NET?

.NET interview questions: - Explain in details about Indexer and can we have static indexer in C#?

.NET interview questions: - What is the difference between arraylist and list? Are Arraylist faster or Arrays?

.NET interview questions: - What is Native Image Generator (Ngen.exe)? Does NGEN.EXE always improve performance?

.NET OOPS interview questions: - What is OOP? What are different properties provided by Object-oriented systems?

.NET OOPS interview questions: - How abstract with only abstract method is it different from interfaces? Also mention best practice to update interface with new methods?

.NET interview questions: - What is the difference between delegate and events? Can we have return type, access modifiers and shared events?

.NET interview questions: - What is Manifest? Where is the version information stored of an assembly? Is versioning applicable to private assemblies?

.NET Generics interview questions: - Explain Generics and concept of Generic Collection in .NET?

How to learn .NET: - In parent-child relationship which constructor will fire first and in which instances you will declare a constructor private?

Basics of .NET and learning tutorials on CTS and CLS


Online resource to learn .NET on Reflection and Dynamic

Online guide to learn .NET for Object initializer in C#?

QuestPond for Freshers on IL code, JIT, CLR, CTS, CLS and CAS

QuestPond: Interview Questions and Answers on AJAX and how does it help?



ASP.NET Interview Questions & Answers Article










MVC Interview Questions And Answers Article

 

(MODEL VIEW CONTROLLER)MVC INTERVIEW QUESTIONS AND ANSWERS

 

MVC INTERVIEW QUESTIONS WITH ANSWERS VIDEO: – WHAT IS WEB API HOW TO IMPLEMENT THE SAME?

 

ASP.NET MVC  4 INTERVIEW QUESTIONS WITH ANSWERS: - WHAT IS BUNDLING AND MINIFICATION IN MODEL VIEW CONTROLLER ?

 

MVC INTERVIEW QUESTIONS WITH ANSWERS :- IS IT POSSIBLE TO RETURN VALUES INSTEAD OF ACTIONRESULTS?

 

MVC INTERVIEW QUESTIONS WITH ANSWERS :- WHAT ARE THE ACTIONRESULTS AVAILABLE IN MVC?

 

MVC INTERVIEW QUESTIONS WITH ANSWERS:-HTML.PARTIALVSHTML.RENDERPARTIALVSHTML.RENDERPAGE IN MVC

MVC VS ASP.NET ( MVC INTERVIEW QUESTION WITH ANSWERS )?

 

HOW CAN WE DETECT THAT A MVC CONTROLLER IS CALLED BY POST OR GET ? ( ASP.NET MVC INTERVIEW QUESTIONS WITH ANSWERS)

 

WHAT ARE THE DIFFERENT WAYS BY WHICH YOU WILL GET FORM DATA IN CONTROLLER? ( MVC INTERVIEW QUESTIONS WITH ANSWERS)

 

WHAT IS THE DIFFERENCE BETWEEN PRESENTER AND CONTROLLER IN MVC?(MVC INTERVIEW QUESTIONS WITH ANSWERS)

 

LEARN MVC (MODEL VIEW CONTROLLER) STEP BY STEP IN 7 DAYS – DAY 4

 

MVC Interview questions and answers PDF

 

MVC interview questions with answers

 

ActionResult vs. View() vs. ViewResult :- MVC interview questions with answers

Explain Areas in MVC?( MVC interview questions with answers)

 

Can you explain the purpose of ViewModel in MVC?( ASP.NET MVC Interview questions with answers)

ASP.NET MVC interview questions: - What are Filters in MVC?

What are areas in MVC?( MVC Interview questions with answers)

Explain the concept of View Model in MVC? 

Exception Handling in MVC

Explain MVC application life cycle?

100 MVC Interview question PDF download released , Enjoy

How can we use two (multiple) models with a single view?(MVC Interview questions)

MVC HTML.Form vs Ajax.Form – MVC interview questions with answers

Learn Microsoft Business intelligence step by step – Day 1

Can you create TempBag just like ViewBag?( MVC Interview questions)

MVC Unit Testing Unleashed

MVC and .NET learning tutorials for components of MVC and how do you perform unit testing in MVC?

Explain MVC model binders ? ( ASP.NET MVC interview questions)

Explain the difference between layout and master pages ? (MVC Razor interview questions) 


ENTITY FRAMEWORK INTERVIEW QUESTIONS ARTICLE


Windows Workflow Foundation(WWF) interview questions with answers Article

XML Interview Questions With Answers Article


Explain XML,DTD and XSL?(XML interview questions with answers)

HTML 5 Interview questions With Answers Article

HTML 5 interview questions with answers for LocalStorage and SessionStorage

 

How is the page structure of HTML 5 different from HTML 4?( HTML 5 Interview questions with answers)

 

What is datalist in HTML 5 ( ASP.NET HTML interview questions)?

 

What are the different new form element types in HTML 5?( ASP.NET HTML 5 interview questions with answers)

 

What is output element in HTML 5?( ASP.NET HTML 5 interview questions)

 

What is the difference between Canvas and SVG graphics?(ASP.NET HTML 5 interview questions with answers)

 

ASP.NET HTML 5 interview questions on SVG and Canvas

ASP.NET HTML5 interview questions with answers

What are web workers and why do we need them ?( ASP.NET HTML interview questions with answers)

 

Why do we need HTML 5 server-sent events? (ASP.NET HTML interview questions)

How can we add and remove data from local storage?(ASP.NET HTML 5 interview questions)

What is local storage concept in HTML 5? ( ASP.NET HTML 5 interview questions)

What is the difference between local storage and cookies? ( ASP.NET HTML 5 interview questions)

What is WebSQL?( ASP.Net HTML 5 interview questions)

 

What is session storage and how can you create one?( ASP.Net HTML 5 interview questions with answers)

 

What is application cache in HTML5?( ASP.NET HTML 5 interview questions with answers)

ASP.NET HTML 5 Application cache interview questions with answers

 

Explain the term cascading in style sheet ? ( CSS Interview questions)

What is difference between DIV vs SPAN in HTML ?( ASP.Net Interview questions)

HTML 5 Canvas Interview questions: - Canvas in HTML 5.

QuestPond’s interview questions and answers on HTML 5

 

Learn HTML 5 in 3 days – Day 1

 

 

 

Dotnetspider Questions And Answers Article

 

 

What is downcasting and upcasting ? ( .NET interview questions with videos)

 

What is the difference between String vs string? ( C# interview questions) ?

 

 

JAVASCRIPT INTERVIEW QUESTIONS WITH ANSWERS ARTICLE

 


3 IMPORTANT JAVASCRIPT IMPORTANT INTERVIEW QUESTION WITH ANSWERS