title: Security Classic ASP
body: <p>Is this secure enough? I don't have any experience with classic ASP or VBScript.</p>
  
  <p>I have a classic ASP page that takes in form data and sends it to another classic ASP page that makes a connection to the database. I use this for my CSRF token on the form input page:</p>
  
  <pre><code>&lt;%
  Dim token
  token = CreateGUID()
  
  Function CreateGUID()
    Dim tmpTemp
    tmpTemp = Right(String(4,48) &amp; Year(Now()),4)
    tmpTemp = tmpTemp &amp; Right(String(4,48) &amp; Month(Now()),2)
    tmpTemp = tmpTemp &amp; Right(String(4,48) &amp; Day(Now()),2)
    tmpTemp = tmpTemp &amp; Right(String(4,48) &amp; Hour(Now()),2)
    tmpTemp = tmpTemp &amp; Right(String(4,48) &amp; Minute(Now()),2)
    tmpTemp = tmpTemp &amp; Right(String(4,48) &amp; Second(Now()),2)
    CreateGUID = tmpTemp
  End Function
  %&gt;
  &lt;input type="hidden" ng-model="user.token" value="&lt;%=token%&gt;"&gt;
  </code></pre>
  
  <p>I'm using an AJAX call (with AngularJS if that matters) in the same page to post the form data to the page that will make a connection to the database.That page looks like this:</p>
  
  <pre><code>&lt;%@ LANGUAGE="VBScript" %&gt;
  &lt;%If Request.ServerVariables("REQUEST_METHOD") = "POST" Then%&gt;
  
      &lt;%If Request.Form("token") = Session("token") Then %&gt;
          'here I make connection to database and and insert rest of form data in database
  </code></pre>