Solution for directory browsing issue in IIS

(In order to Enlarge images Please Right Click and Open images in New Tab).

 

2

 

dw1

 

Then enable directory browsing as shown in below image

 

mvpskills1

Advertisements

removing special symbols from querystring while sending data to webapi controller action

 

(In order to Enlarge images Please Right Click and Open images in New Tab)

3

Since URL:won’t Accept any special symbols like  #,@,etc…. So we have to use below options

You have three options:

  • escape() will not encode: @*/+
  • encodeURI() will not encode: ~!@#$&*()=:/,;?+'
  • encodeURIComponent() will not encode: ~!*()'

2

loginService.UpdatePassword = function (changePasswordDetails, password, confirmPwd) {
var request = $http({
url: apiConstants.API_URL + “api/Login/UpdatePassword?changePasswordDetails=” + JSON.stringify(changePasswordDetails) + “&password=” + encodeURIComponent(password) + “&confirmPwd=” + encodeURIComponent(confirmPwd),
dataType: ‘json’,
method: ‘POST’,
});
return request;
}

 

v1

public HttpResponseMessage UpdatePassword(string changePasswordDetails, string password, string confirmPwd)
{

HttpResponseMessage resp;

resp = Request.CreateResponse(HttpStatusCode.OK, strUpdatePwdStatus);
return resp;

}

asp.net webapi basic details

2

(In order to Enlarge images Please Right Click and Open images in New Tab)

What is ASP.NET Web API?

ASP.NET Web API is a framework that simplifies building HTTP services for broader range of clients (including browsers as well as mobile devices) on top of .NET Framework.
Using ASP.NET Web API we can create non-SOAP based services like plain XML or JSON strings etc. with many other advantages including:

  • Create resource-oriented services using the full features of HTTP.
  • Exposing services to a variety of clients easily like browsers or mobile devices etc.

What are the advantages of using ASP.NET Web API?

Using ASP.NET Web API has a number of advantages, but core of the advantages are:

  • It works the HTTP way using standard HTTP verbs like GET, POST, PUT, DELETE etc for all CRUD operations.
  • Complete support for routing.
  • Response generated in JSON or XML format using MediaTypeFormatter.
  • It has the ability to be hosted in IIS as well as self-host outside of IIS.
  • Supports Model binding and Validation.
  • Support for OData.

What new features are introduced in ASP.NET Web API 2.0?

More new features introduced in ASP.NET Web API framework v2.0 are as follows:

  • Attribute Routing
  • External Authentication
  • CORS (Cross-Origin Resource Sharing)
  • OWIN (Open Web Interface for .NET) Self Hosting
  • IHttpActionResult
  • Web API OData

WCF Vs ASP.NET Web API?

Actually, Windows Communication Foundation is designed to exchange standard SOAP-based messages using variety of transport protocols like HTTP, TCP, NamedPipes or MSMQ etc.
On the other hand, ASP.NET API is a framework for building non-SOAP based services over HTTP only.

MVC Vs ASP.NET Web API?