2 Replies - 1240 Views - Last Post: 19 October 2009 - 04:07 AM

#1 Striker9099  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 19-October 09

AS 3.0 / C# Contact Form

Post icon  Posted 19 October 2009 - 01:43 AM

Hello there. I am trying to develop a contact form in AS 3.0 / C#. I already have my AS 3.0 code but I do not know where to start in the C# code. I could've easily done it in PHP, but the guy I'm doing this project for insisted that it should be in ASP.NET. I do know basic C# and ASP.NET but I'm still in the early stages of my ASP.NET learning. So, I would really appreciate some here. I'm not sure if there's some POST method in C# but that's what I'm looking for because that's how I'll be sending the variables from AS 3.0... here's my code:

Actionscript 3.0 Code:
var variables:URLVariables = new URLVariables;
var varSend:URLRequest = new URLRequest("//ASP filename");
varSend.method = URLRequestMethod.POST;
varSend.data = variables;

var varLoader:URLLoader = new URLLoader;
varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
varLoader.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void {
	name_txt.text = "";
	email_txt.text = "";
	message_txt.text = "";
	phone_txt.text = "";
	company_txt.text = "";
	
	status_txt.text = event.target.data.return_msg;
}

submit_btn.addEventListener(MouseEvent.CLICK, ValidateAndSend);

function ValidateAndSend (event:MouseEvent):void {
	
	if(!name_txt.length) {
		status_txt.text = "Please enter your name";
	} else if (!email_txt.length) {
		status_txt.text = "Please enter your email";
	} else if (!message_txt.length) {
		status_txt.text = "Please enter your message";
	} else {
		variables.userName = name_txt.text;
		variables.userEmail = email_txt.text;		
		variables.userMessage = message_txt.text;
		variables.userCompany = company_txt.text;
		variables.userPhone = phone_txt.text;
		
		varLoader.load(varSend);	
	} 	
}



Is This A Good Question/Topic? 0
  • +

Replies To: AS 3.0 / C# Contact Form

#2 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: AS 3.0 / C# Contact Form

Posted 19 October 2009 - 03:30 AM

You might be better posting this question in the C# forum, but to get you started I think you access POST properties in C# like this: Request.Form["variableName"].
Was This Post Helpful? 0
  • +
  • -

#3 Striker9099  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 41
  • Joined: 19-October 09

Re: AS 3.0 / C# Contact Form

Posted 19 October 2009 - 04:07 AM

ok I guess you are right, I will post the topic in the C# forum. thanks for the input :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1