c# - ASP.NET HTTP to HTTPS redirect with www prefix -
i using simple code redirect http https on billing landing page:
if (!request.issecureconnection) { // send user ssl string servername =httputility.urlencode(request.servervariables["server_name"]); string filepath = request.filepath; response.redirect("https://" + servername + filepath); }
i need check , add www url if not in url. need add code accomplish this?
like this:
if (!servername.startswith("www.")) servername = "www." + servername;
Comments
Post a Comment