Reputation: 128
I am having Http
reference in my html
[referring Java script
files hosted by google] and i have a Https
site so when the page loads it shows "Only secured content is displayed".
I need to make this call Https instead of http. I trued accessing http request in Application_BeginRequest method but it turn out to be, Request object is read only.
Please suggest any method
Upvotes: 0
Views: 117
Reputation: 1091
You can change the reference to https. Google offers all of their links with http and https addresses. You can change the request to https from the source code, there is no need to dynamically change it in Application_BeginRequest.
If you really had to do it in the Application_BeginRequest phase you could use this code:
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
If Not Request.IsSecureConnection Then
Dim path As String = String.Format("https{0}", Request.Url.AbsoluteUri.Substring(4))
Response.Redirect(path)
End If
End Sub
Upvotes: 0
Reputation: 20224
This is a security measure of the browser.
Check whether you can get the script when changing http to https - sometimes google js files are accessible via https also.
The only other possibility - which additionally helps to circumvent cross-site scripting problems - is to have the server fetch the file from google via http, and serve it via https to its own application.
Upvotes: 1