2

I want my application to serve all of its web pages over SSL, so I added the lines...

<secureWebPages enabled="true">
<directory path="." />
</secureWebPages>

... to my Web.config and the resulting compiler error is:

Build (web): Unrecognized configuration section secureWebPages.

I am running Visual Studio 2008

2
  • Possible duplicate of stackoverflow.com/questions/2393114/… Commented Jun 4, 2010 at 18:03
  • Which version of the .NET framework is the site running on? Commented Jun 4, 2010 at 18:09

2 Answers 2

5

Sounds like you might need to add the appropriate configSections...

<configuration>
  <configSections>
    <!-- modify as you need. -->
    <section 
        name="secureWebPages" 
        type="Hyper.Web.Security.SecureWebPageSectionHandler, 
        WebPageSecurity" 
        allowLocation="false" />
  </configSections>


   <secureWebPages mode="On" > 
    <directories>
        <add path="/" recurse="True" />
    </directories>
</secureWebPages>
Sign up to request clarification or add additional context in comments.

Comments

3

If you want a simple, quick solution to work for your entire web application, you could add this to the Application_BeginRequest method in your Global.asax file.

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
...
    If Request.IsSecureConnection = False Then
        Dim ub As New UriBuilder(Request.Url)
        ub.Scheme = Uri.UriSchemeHttps
        ub.Port = 443
        Response.Redirect(ub.Uri.ToString, True)
    End If
...
End Sub

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.