Question: I have the a page and I want to conditionally return the contents of the `body` tag only. The condition is `ViewBag.BodyOnly` 

I've tried the following, but I get `The if block is missing a closing "}" character. Make sure you have a matching "}" character for all the "{" characters within this block, and that none of the "}" characters are being interpreted as markup` error:

```
@if (ViewBag.BodyOnly) {

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Title</title>
</head>
<body>

}
    <div>this</div>
    <div>that</div>

@if (ViewBag.BodyOnly) {

</body>
</html>

}

```

What am I missing here?

Answer: 
As shown in official [link](https://developer.android.com/reference/javax/net/ssl/SSLSocket), 
TLSv1.3 is supported from Android 10(Api Level 29) on wards. So to support TLSv1.3 in previous versions we can integrate the [conscrypt](https://github.com/google/conscrypt) library. Conscrypt security provider includes a public API for TLS functionality. For that we have to add the dependency,

```
dependencies {
  implementation 'org.conscrypt:conscrypt-android:2.2.1'
}

```

Here also we need OkHttp client as it supports conscrypt. 

As documented in [OkHttp](https://square.github.io/okhttp/),

> 
> OkHttp uses your platform’s built-in TLS implementation. On Java
>  platforms OkHttp also supports Conscrypt, which integrates BoringSSL
>  with Java. OkHttp will use Conscrypt if it is the first security
>  provider.
> 
> 
> 

After adding conscrypt dependency, in application class we just have to mention,

```
Security.insertProviderAt(Conscrypt.newProvider(), 1);

```

This can be helpful to provide support and enable TLS 1.3 in older android version (Api level <29).
The problem is likely, that the client or the certificate might not support TLS 1.3 in all situations - and then will fall back. Try running [SSL test](https://www.ssllabs.com/ssltest/analyze.html) to verify that (it also performs checks for mobile clients, which might negotiate differently). Upgrading OhHttp to `3.13` or `3.14` (soon) might also be an option; here's the [change log](https://github.com/square/okhttp/wiki/TLS-Configuration-History). even if Android should support it, the client needs to be configured, as well:

```
OkHttpClient client = new OkHttpClient.Builder()
    .connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS))
    .build();

```

Possible values there are: `RESTRICTED_TLS`, `MODERN_TLS` and (backwards) `COMPATIBLE_TLS`.