Groups | Blog | Home
all groups > flash actionscript > december 2005 >

flash actionscript : Urgent: Flash 2004 hanging with ASP.NET


jay mehta
12/16/2005 5:32:58 PM
I have a script in ASP.NET that works fine from simple HTML form and returns
acknowledgement page. But when I call from Flash ActionScript code, it does
not return control (sending back response "return=ok") and Flash movie hangs.
In fact, none of my server side scripts in ASP.NET are working, meaning
returning control back to Flash.

ASP.NET code attached.

I have been struggling for weeks to make serverside scripts in ASP.NET work
with Flash. Is there something simple about Flash and ASP.NET scripts that I
have missed? Any help desperately appreciated.

Thanks
Jay



<%@ Page Language="VB" EnableSessionState="False"
EnableViewState="False" Trace="False" Debug="True"%>
<%@ Import Namespace="System.Web.Mail" %>
<script language="VB" runat=server>

sub Page_Load
'Response.Write(Request.Form("Email"))
Dim objMail As New MailMessage()
objMail.From = "info@test.com"
objMail.To = Request.Form("Email")
objMail.Subject = Request.Form("Subject")
objMail.Body = Request.Form("Message")
objMail.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer.insert(0,"127.0.0.1")
SmtpMail.SmtpServer = "127.0.0.1"
'SmtpMail.SmtpServer = "mail.test.com"

objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectio
ntimeout", 60)
SmtpMail.Send(objMail)
lbl1.Text="Mail Sent to " & Request.Form("Email")
Response.Write("result=ok")
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<h3><asp:label id="lbl1" runat="server" /></h3>
</form>
</body>
</html>
Ronak Bhagdev
12/16/2005 6:01:34 PM
Hello,

jay mehta
12/16/2005 6:08:25 PM
Thanks. What more details? Let me ask my partner to take up this thread tomorrow.

Ronak Bhagdev
12/17/2005 2:00:11 PM
Hello,

All in details. R u using loadVariablesNum("XYZ.aspx", "0", "POST")?
Have u 'result' variable in flash.?
jay mehta
12/17/2005 4:47:21 PM
Here is my AS code...

//setup variables to send
myLoadVars = new LoadVars();

var vName:String = this._parent.tf1.text;
myLoadVars.Name = vName;

var vCompany:String = this._parent.tf2.text;
myLoadVars.Company = vCompany;

//set up object to receive
myLoadVarsReceive = new LoadVars();
myLoadVarsReceive.onLoad = function(success){
if(success){
this._parent.tf8.text = "Mail sent.";
} else {
this._parent.tf8.text = "Mail was not sent.";
}
}

//send email
myLoadVars.sendAndLoad("XYZ.aspx", myLoadVarsReceive, "POST");

}

******End of Code **********

I don't get the result back in "myLoadVarsReceive.onLoad()" function...



flash-hero
12/17/2005 10:09:51 PM
You should use a webservice in dot.net then it will be extremely easy: like:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;

namespace name
{
[WebService(Namespace="http://namehere/",
Description="This is the ....")]
public class contactSP : System.Web.Services.WebService
{
public contactSP()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion


[WebMethod]
public bool InsertContact(string cemail,string cname, string cmessage)
{
SqlConnection sqlConnection1 = new SqlConnection();
sqlConnection1.ConnectionString = "Persist Security Info=False;Integrated
Security=false;database=name;data source=sqlserver;Connect Timeout=30;User
ID=username;pwd=password";
SqlCommand command1 = new SqlCommand("insertContact",sqlConnection1);
command1.CommandType=CommandType.StoredProcedure;
command1.Parameters.Add("@cname",cname);
command1.Parameters.Add("@cemail",cemail);
command1.Parameters.Add("@cmessage",cmessage);
sqlConnection1.Open();
int i=command1.ExecuteNonQuery();
sqlConnection1.Close();
if (i!=-1)
{
return true;
}
else
{
return false;
}
}
}
}

flashhero

Ronak Bhagdev
12/18/2005 3:02:59 PM
Hello,

Use easy code. Don't use such long and hard code.

Have u used loadVariablesNum("inqiry.asp", "0", "POST"); ?

Use this code..

Write this script on button

on(press){
vName = this._parent.tf1.text;
vCompany = this._parent.tf2.text;
}
on(release){
oadVariablesNum("XYZ.aspx", "0", "POST");;
}

Remember you should have both variable in ur .aspx file.

If it doesn't work than tell me. I will send .fla file




AddThis Social Bookmark Button