2021-10-07 13:41:08 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
using System.Web;
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
public ActionResult index(string key, string val)
|
|
|
|
{
|
|
|
|
Response.AddHeader(key, val); // Noncompliant
|
|
|
|
HttpCookie cookie = new HttpCookie(key, val); // Noncompliant
|
|
|
|
Response.AppendCookie(cookie);
|
|
|
|
return View("");
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
using System.Web;
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
public ActionResult index(string val)
|
|
|
|
{
|
|
|
|
Response.AddHeader("X-Data", val);
|
|
|
|
HttpCookie cookie = new HttpCookie("data", val);
|
|
|
|
Response.AppendCookie(cookie);
|
|
|
|
return View("");
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
|
|
|
|
|
|
|
|
2021-09-20 15:38:42 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Implementation Specification
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../message.adoc[]
|
|
|
|
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
|
2021-10-07 13:41:08 +02:00
|
|
|
endif::env-github,rspecator-view[]
|