Click here to Skip to main content
16,016,759 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hOW CAN i REDIRECT FROM HTTP TO HTTPS IN LOCAL HOST? i TRIED WITH RESPONSE.REDIRECT Code as follows:
Response.Redirect("https://" + pageRequest.Host + pageRequest.PathAndQuery, true);
SQL
BUT THE URL COMING IS HTTP INSTEAD OF HTTPS.
Posted
Comments
DipsMak 29-Jan-14 8:01am    
have you tried using SSL Certificate ?

1 solution

you have to read what is Https and what is SSL first.

for detail refer below links:-
http://webdesign.about.com/od/ecommerce/a/aa070407.htm[^]
http://www.clintharris.net/2009/self-signed-certificates/[^]
 
Share this answer
 
Comments
Rahul 105 29-Jan-14 8:34am    
I have enabled the ssl certificate in client server. I ran this on my local system. So how to see it gets converted.
Rahul 105 29-Jan-14 8:39am    
I tried these too:
Redirect HTTP requests to HTTPS on IIS 7 using URL Rewrite 2.0
Hi,

You will need the following items completed in order for this to work correctly :

a) SSL Certificate for site installed in IIS.
b) Site properly installed and configured for SSL (site set up and binding in IIS configured).
c) URL Rewrite 2.0 is installed on the sever.

URL Rewrite has a GUI to allow you to enter rules within IIS 7; in the background all this does is edit the web.config file of the site.

1. In IIS select the website you wish to configure
2. In the “Features View” panel, double click URL Rewrite
3. You will notice there are currently no rules configured for this site. Click “Add Rules…” in the Actions menu to the right of the “Features View” panel
4. Use the default “Blank rule” and press “OK”.

5. When editing a rule there are the “Name” field and 4 configuration pull down boxes.

- Enter “Redirect to HTTPS” in the name field.
- Next we will configure the first configuration pull down box called “Match URL”, on the right side of “Match URL” press the down arrow to expand the box.
Within the “Match URL” configuration box we will set the following settings:

Requested URL: Matches the Pattern
Using: Regular Expressions
Pattern: (.*)

6. We can now edit the next configuration pull down box which is “Conditions”, Press “Add…” to add a new condition to the configuration.
We will configure the condition with the following settings:

Condition Input: {HTTPS}
Check if input string: Matches the Pattern
Pattern: ^OFF$

7. Press “OK”

8. You should see your condition in the list of conditions.

For this setting we do not need to configure the “Server Variables” pull down box. Continue onto the “Action” configuration box and pull down the box by selecting the arrow on the right. We will configure the following settings for the “Action” configuration:

Action Type: Redirect
Redirect URL: https://{HTTP_HOST}/{R:1}
Redirect Type: See Other (303)

9. Press “Apply” then press “Back to Rules”

10. You should now see the rule configured on the main screen of the URL Rewrite module.

11. Test your site, it should now redirect from HTTP to HTTPS.
SSL cert is enabled and with https its fine.
But on changing https to http it isn't redirecting to https.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900