ASP.NET - consumes web service - only https - how?
I have web services built using ASP.NET and ASP.NET clients. When you're using web services, how do I get clients to use https?
I don't want the whole site to use https by enabling the required SSL in IIS.
Can I use the IIS7 URL Rewriter Module to redirect HTTP requests to https?
+2
a source to share
2 answers
Can you add your web services to the virtual directory and just force the virtual directory to use SSL? Along with the validation inside webservice calls, as Fedor suggests, you can add validation Application_BeginRequest
to yours global.asax
, although this is not very neat:
void Application_BeginRequest(object sender, EventArgs e)
{
if (!Request.IsSecureConnection && Request.Url.ToString().Contains(".asmx"))
{
string secureUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(secureUrl);
}
}
+3
a source to share