Hi Dharmendr,
Thanks for your reply, i was checked the provided solution but it's not working,and also tried different ways to resolve the issue, am not able to do this.
tried with below filter in webApiconfig.cs file, still getting the 404 response,and the json api is perfectly working on postman site am getting the json response.
please help me to resolve this.
Thanks
public class RequireHttpsAttribute : AuthorizationFilterAttribute
{
public override void OnAuthorization(HttpActionContext actionContext)
{
var request = actionContext.Request;
if (request.RequestUri.Scheme != Uri.UriSchemeHttps)
{
HttpResponseMessage response;
UriBuilder uri = new UriBuilder(request.RequestUri);
uri.Scheme = Uri.UriSchemeHttps;
uri.Port = 443;
string body = string.Format("<p>The resource can be found at <a href=\"{0}\">{0}</a>.</p>",
uri.Uri.AbsoluteUri);
if (request.Method.Equals(HttpMethod.Get) || request.Method.Equals(HttpMethod.Head))
{
response = request.CreateResponse(HttpStatusCode.Found);
response.Headers.Location = uri.Uri;
if (request.Method.Equals(HttpMethod.Get))
{
response.Content = new StringContent(body, Encoding.UTF8, "text/html");
}
}
else
{
response = request.CreateResponse(HttpStatusCode.NotFound);
response.Content = new StringContent(body, Encoding.UTF8, "text/html");
}
actionContext.Response = response;
}
}
}