# Pass variables from AS3 to asp

**URL:** <https://forum.kirupa.com/t/pass-variables-from-as3-to-asp/283495>\
**Category:** flash\
**Created:** [March 6, 2009, 9:05pm UTC](https://forum.kirupa.com/t/pass-variables-from-as3-to-asp/283495 "2009-03-06T21:05:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha\_Remex](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@Alpha\_Remex](https://forum.kirupa.com/u/Alpha_Remex)\
**Post date:** [March 6, 2009, 9:05pm UTC](https://forum.kirupa.com/t/pass-variables-from-as3-to-asp/283495/1 "2009-03-06T21:05:50Z")

</div>

Ok - I’m getting really close here… I have some as3 script passing variables to an asp script which writes a text file for me.

Here’s the AS3:

```auto

stop();

import flash.events.*;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;

var variables:URLVariables = new URLVariables();
var varSend:URLRequest = new URLRequest("test.asp");
var varLoader:URLLoader = new URLLoader();

variables.testName = "Bob";

varSend.method = URLRequestMethod.POST;
varSend.data = variables;

t.buttonMode = true;
t.addEventListener(MouseEvent.CLICK, iii);

function iii(e:MouseEvent):void {
    varLoader.load(varSend);
}

```

Here’s the ASP:

```auto

<html>
<body>
<%
testvar = Request.QueryString("testName")

Set fs = CreateObject("Scripting.FileSystemObject")
Set wfile = fs.CreateTextFile(Server.MapPath("myfile.txt"))

wfile.Write ("myReply " + testvar)

wfile.close
Set wfile=nothing
Set fs=nothing
%>
</body>
</html>

```

The output I get in the file right now is “myReply”… in other words, the variable is either not passing in correctly, or I am not retrieving it in the ASP code correclty.

Any ideas?
