# 13.2: SSL

## Add SSL for Release Builds

SSL (Secure Sockets Layer) is a security technology that encrypts communication between a web browser and a server, using HTTPS (HTTP Secure) instead of HTTP (Hypertext Transfer Protocol). Here we will set the app up to require HTTPS unless we are in debug mode.

1. Open **ElevenNote.Web -> Controllers -> AccountController**
2. Add this annotation above the routes.

   ```csharp
    namespace ElevenNote.Web.Controllers
    {

    #if !DEBUG
        [RequireHttps]

    #endif
    [Authorize]
    public class AccountController : Controller
   ```

   This code includes what are called `#if` and `#endif` preprocessor directives. These act essentially like a standard if statement but are used for determining some things at the beginning of compiling the code instead of while running it. An `#if` directive must always be followed at some point by an `#endif`. Here's [the Microsoft documentation](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/) on preprocessor directives in C#, if you're interested.
3. Change the tab from **Debug** to **Release**. Notice the code is commented/un-commented depending on the setting.

   ![Debug v Release](https://3258533034-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfMZK4G04fkoGGv%2F-LAxmw8y5qK1VLyUF4ln%2F-LAxmxhrS859_VBUwOUW%2F13.2-A.png?generation=1524676419795818\&alt=media)
4. Set the drop-down back to **Debug** and ![Git](https://3258533034-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfMZK4G04fkoGGv%2F-LAwyv0-ttugakHO6zeV%2F-LAwyxUd0dcYSLXYb-5s%2Fdevicons_github_badge.png?generation=1524662787257488\&alt=media)

[Next,](https://eleven-fifty-academy.gitbook.io/dotnet-201-elevennote/elevennote-api-parts-13-19/part-14-webapi/14.0-webapisetup) we'll set up the WebAPI project.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eleven-fifty-academy.gitbook.io/dotnet-201-elevennote/elevennote-api-parts-13-19/part-13-api-intro/13.2-ssl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
