Description The SSL Certificate Details provide information about the certificate associated with the HTTPS server. This information describes important attributes of the certificate and should be reviewed for the correctness of the contact information, whether it is self-signed, and how soon it will expire. The Supported Ciphers provides information about each available encryption scheme available for each of the possible SSL/TLS protocols.
Recommendations The expiration date for certificates should be monitored. New certificates should be available before the expiration date in order to maintain continuity of service and avoid downtime or displaying certificate expiration errors in users’ web browsers.

Description “Server Side Request Forgery” (a.k.a. SSRF) is a class of web-application vulnerability in which an attacker can cause a website to access unintended server-side resources, including the unauthorized reading, writing, or execution of server resources.
Web-applications designed to pass URLs (references to server accessible content) or portions thereof, from the client browser to the application server using HTTP request parameters or HTTP request headers, are at risk for Server Side Request Forgery exploitation unless they protect against it.
Server-side Request Forgery (SSRF) is related to another type of vulnerability called Open Redirects in the sense that they both rely on untrusted input to reference other web-resources.
Strategies for avoiding and/or fixing Server-Side Request Forgery include:
Design around it: Unless there is a reason why URL information must be passed, avoid the problem entirely by implementing an alternative design. Validation: When a URL value is received by the application, it must be white-list validated against the domain of possible legitimate values and rejected if it is not a member. Indirect References: In some cases, it may be possible to pass a (cryptographically strong) random value that represents the target URL and maintain a token: URL mapping on the server. Since URLs are never passed and the tokens are (practically) un-guessable, the vulnerability is eliminated. If URI is hard-coded, then the attacker cannot influence where the request is going, so it would look to be a false positive. However, although some scanning software is known for false positives, you need to be careful, as most scanning software are correct in their analysis. You need to check the whole source-to-sink trace that scanning software provides? If it is reporting only that one line as the source and sink, then yes it is a false positive.
Useful links:
https://www.owasp.org/index.php/Server_Side_Request_Forgery

Description A function call contains an HTTP response splitting flaw. Writing untrusted input into an HTTP header allows an attacker to manipulate the HTTP response rendered by the browser, leading to cache poisoning and cross-site scripting attacks.
Recommendations Remove unexpected carriage returns and line feeds from untrusted data used to construct an HTTP response. Always validate untrusted input to ensure that it conforms to the expected format, using centralized data validation routines when possible.
A simple string extension can resolve this issue:
public static string CRLFRemoval(this string token) {
return token.Replace("%0d", string.Empty, StringComparison.InvariantCultureIgnoreCase)
.Replace("%0D", string.Empty, StringComparison.InvariantCultureIgnoreCase)
.Replace("\r", string.Empty)
.Replace("\n", string.Empty)
.Replace("%0a", string.Empty, StringComparison.InvariantCultureIgnoreCase)
.Replace("%0A", string.Empty, StringComparison.InvariantCultureIgnoreCase);
}
Links for reference:
https://en.wikipedia.org/wiki/HTTP_response_splitting
https://securiteam.com/securityreviews/5WP0E2KFGK
https://www.owasp.org/index.php?title=Testing_for_HTTP_Splitting/Smuggling_(OTG-INPVAL-017)

It is important that when writing RESTful API’s that the correct HTTP status code is returned, the best and only source of reference has to be: https://httpstatuses.com/
1×× Informational 100 Continue 101 Switching Protocols 102 Processing 2×× Success 200 OK 201 Created 202 Accepted 203 Non-authoritative Information 204 No Content 205 Reset Content 206 Partial Content 207 Multi-Status 208 Already Reported 226 IM Used 3×× Redirection 300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 304 Not Modified 305 Use Proxy 307 Temporary Redirect 308 Permanent Redirect 4×× Client Error 400 Bad Request 401 Unauthorized 402 Payment Required 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 407 Proxy Authentication Required 408 Request Timeout 409 Conflict 410 Gone 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 Request-URI Too Long 415 Unsupported Media Type 416 Requested Range Not Satisfiable 417 Expectation Failed 418 I’m a teapot 421 Misdirected Request 422 Unprocessable Entity 423 Locked 424 Failed Dependency 426 Upgrade Required 428 Precondition Required 429 Too Many Requests 431 Request Header Fields Too Large 444 Connection Closed Without Response 451 Unavailable For Legal Reasons 499 Client Closed Request 5×× Server Error 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported 506 Variant Also Negotiates 507 Insufficient Storage 508 Loop Detected 510 Not Extended 511 Network Authentication Required 599 Network Connect Timeout Error
MSMQ (Microsoft Message Queuing) is a message queue that is available by default as part of Windows. A reliable way of sending and receiving messages across computer systems, MSMQ provides a queue that’s scalable, thread-safe, simple, and convenient to use while at the same time providing you with the opportunity to persist the messages inside the Windows database.
The problem? How can application A, handle events sent by an application B, and how to implements those events in B? Knowing that B has no idea of the existence of A.
The MemoryMapped way The following example shows how it would work, with the restriction that both applications are using the same memory space. In real code, the producer() method would be in a different application from the consumer() method, but this serves to illustrate an implementation:
It is sometimes useful to know which database you are connected to, here is a simple method that pulls apart the connection string and provides you with the section you request.
private static string GetSection(string section) { var connectionString = string.Empty; Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/MyWebSiteRoot"); ConnectionStringSettings connString;
if (rootWebConfig.ConnectionStrings.ConnectionStrings.Count > 0) { connString = rootWebConfig.ConnectionStrings.ConnectionStrings[“Entities”]; if (connString != null) connectionString = connString.ConnectionString; }
string[] parts = connectionString.Split(’;’);
for (int i = 0; i < parts.Length; i++) { string part = parts[i].Trim().ToLowerInvariant(); if (part.StartsWith($"{section}=")) { return part.Replace($"{section}=", “”); } }
return “Unknown”; }
Install ASP.NET and Web Tools 2012.2 Update. This update integrates help pages into the Web API project template.
Next, create a new ASP.NET MVC 4 project and select the Web API project template. The project template creates an example API controller named ValuesController. The template also creates the API help pages. All of the code files for the help page are placed in the Areas folder of the project.
Here is a simple example of how to use Bing Maps in an MVC application.
I am using Bing Maps V8 which is the current version of Microsoft.
Also, nothing that document.ready will fire long before the map script loads as it loads asynchronously. Sometimes document.ready will fire before the page is loaded which means the map div might not even be available. To overcome this, we are using the callback parameter of the map script UR: for example:
(Added LazyCache in to the Testing)
One of the essential factors in building high-performance, scalable Web applications is the ability to store items, whether data objects, pages, or even parts of a page in memory the initial time they are requested. You can save these items on the Web server or other software in the request stream, such as a proxy server or at the browser. This allows you to avoid recreating information that satisfied a previous request. Known as caching, it will enable you to use many techniques to store page output or application data across HTTP requests and reuse it. When the server does not have to recreate information you save time and resources, and throughput and scalability increase.
The Repository Pattern used to be the next big thing when it was used, but over time it got replaced by frameworks such as the Entity Framework and LINQ, which provided much more functionality and flexibility.
When you are dealing with large amounts of data or processes that are very time hungry you sometimes need the ability to timeout that task and continue.
Here is a snippet of code that loops around that takes 1 second, and you can set a timeout to any time you like, but if it is less than 1 second, it will cancel the task and free up resources.
Some differences between ASMX and WCF services are subtle and some differences between them are not subtle. The purpose of this section is to identify many of these differences and to provide guidance for how to handle them when preparing for, or when performing, migration. ASMX provides a very successful baseline for services, and WCF extends those capabilities for the next generation of services.
Attributes are advantageous in C# to provide none business-related functionality in an application or to abstract out the code to make it easier to follow.
The issue is when does the attribute code get called and how do you force it to run?
Let’s start with a simple JSON string. In most cases, you will get this string from a web service call. For the sake of this tutorial, we will do this manually.
var example1 = @"{""name"":""John Doe"",""age"":20}"; example1 is a simple JSON object with 2 fields: name and age.
The following is a symmetric encryption/decryption routine using AES in GCM mode. This code operates in the application layer and is meant to receive user-specific and confidential information and encrypt it, after which it is stored in a separate database server. It also is called upon to decrypt encrypted information from the database.
The DatabaseLayer is an abstraction for database access which means the calling application or library does not need to be tight-coupled to the database itself. A set of factory methods is available to call in order to create commands and parameters, all based on the .NET abstract base classes.
This is how, within your organisation, you can protect the data, especially in a cloud-first, multi-tenant world. The source will provide you with the concepts around encrypting enterprise data, look at what you should encrypt, and cover robust patterns and practices you can follow in your organisation.