我在我的silverlight应用程序中调用了一个aspx页面,在目录上创建并注册一个txt文件。在silverlight中调用一个aspx页面,而不打开它
Uri ub = (new Uri(HtmlPage.Document.DocumentUri, "GenereInfos.aspx?&connexion=" + connexion + ";&id=" + this.Id));
if (HtmlPage.IsPopupWindowAllowed)
{
HtmlPopupWindowOptions opt = new HtmlPopupWindowOptions();
HtmlPage.PopupWindow(ub, "file", opt);
}
else
{
HtmlPage.Window.Navigate(ub);
}
我必须去我的aspx页面生成我的txt文件,因为silverlight不允许它。
这里的问题是,会出现一个弹出窗口,或者页面将加载新的uri。
我想要的只是调用内部的ASP代码(完美的工作),而无需加载uri。
有没有办法做到这一点?
编辑: DGibbs的答案后,还有另外一个问题,现在:在那里
WShy我不能使用的GetResponse()?
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(new Uri
(HtmlPage.Document.DocumentUri, "GenereInfos.aspx?&connexion=" + connexion + ";&idPocedure=" + itmProcedure.IdProcedure));
string response = new System.IO.StreamReader(req.GetResponse().GetResponseStream()).ReadToEnd();
这一点答案:Silverlight是asynchrnous,所以,我们不能说谁的GetResponse是同步的。
所以,叫我aspx页面的最佳方式,是使用Web客户端found here
是它写在本地或远程目录? – screenmutt
在本地,但我也可以选择一个远程目录(使用一个字符串就是我的aspx)。目前,我得到myDocuments文件夹来放置我的txt文件。 –
[编写使用Silverlight一个文件](http://stackoverflow.com/questions/753646/can-i-write-a-file-on-the-clients-pc-using-silverlight) 如果此ISN你的最终目标,让我知道。 – screenmutt