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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -