c# - Selectively redirect to https, not all pages -
i have website requires secure pages logging in, user accounts, form submission etc. not need secure on pages.
certificate purchased , installed on www.mywebsite.com.
i redirecting users https using c# code in page_load:
if (!request.islocal && !request.issecureconnection) { string redirecturl = request.url.tostring().replace("http:", "https:"); response.redirect(redirecturl); }
my concern after visiting secure page , user clicks on page, stays secure rather going http.
i have looked @ number of options including iis rewrite (it's whole other language , complicated) , coding globally (redirects every page, not selective).
is there simple solution allow me redirect https on selected pages (about 10 or pages, or pages in particular folder) , http on others? i'm not greatest coder in world, trying find easy implement , understand.
if portion of website requires ssl, recommend use ssl throughout. unnecessarily opening potential data loss doing else. check out owasp top ten more info.
Comments
Post a Comment