Provides a random token and stores it in the session. You can also provide a specific key to store in the session.
Token
Display and formatting functions
CSRFGenerateToken([key] [,forceNew])
ColdFusion 10: Added this function.
Parameter |
Required\Optional |
Description |
|---|---|---|
key |
optional |
A random token is generated based on the key provided. This key is stored in the session. |
forceNew |
optional |
If set to true, a new token is generated every time the method is called. If false, in case a token exists for the key, the same key is returned. |
Use this function to create a random token and store it in the session.
<cfset csrfToken=CSRFGenerateToken() /> <cfform method="post" action="sayHello.cfm"> <cfinput name="userName" type="text" > <cfinput name="token" value="#csrfToken#" type="hidden" > <cfinput name="submit" value="Say Hello!!" type="submit" > </cfform>
Sign in to your account