Problem WIth Dynamic URL from querystring in actionscript and returning XML from asp.net
hello friends,
i was trying to return the text to SWF from asp.net through a URL.
if i pass the complete url to the URLRequest then it is working fine.
but if i try to use the querystring and do the concatenation and pass the text then i am getting a problem ...
its just not working ... i cant see any output at all.
lets say filename is someContent
Flash CODE :
var pa = MainMc.loaderInfo.parameters;
var path="http://localhost:51791/Home/GetSomeContent/?path="; // if i give the URL as
//"http://localhost:51791/Home/GetSomeContent/?path=contentName"
// then it is working absolutely fine, if i try to do the concatenation with the parameters then i am having the problem
if(pa.ttt != null && pa.ttt != "undefined")
{
path = path + pa.ttt;
}
var urlRequest:URLRequest = new URLRequest(path);
urlRequest.contentType = "text/html";
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE,completeHandlertext);
urlLoader.load(urlRequest);
HTML CODE:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="600" id="loader" align="middle">
<param name="movie" value="/Files/SWF/main.swf?ttt=contentName" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDoloader" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="/Files/SWF/main.swf?ttt=contentName" width="800" height="600">
<param name="movie" value="/Files/SWF/main.swf?ttt=contentName" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDoloader" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
ASP.NET CODE :
Response.Buffer = false;
Response.ContentType = "text/html";
var path = Request.QueryString["path"];
if(part!=null)part = part.Trim();
if (string.IsNullOrEmpty(part))
path = Server.MapPath(Url.Content("~/Files/" + path + "/xml/content.txt"));
byte[] buffer = new byte[1 << 16];// 64kb
int bytesRead = 0;
using (var file = System.IO.File.OpenRead(path))
{
while ((bytesRead = file.Read(buffer, 0, buffer.Length)) != 0)
{
Response.OutputStream.Write(buffer, 0, bytesRead);
}
}
Response.Flush();
Response.Close();
//Response.End();
Would anyone please help me solving this problem . i dont want to create a new file everytime to get some content,
instead i want to use the same SWF for displaying dynamic based upon the URL.
please help me
thanks in advance.
