这是从您的博客上下载的Demo,Asp.net和Silverlight交互,用的是Request.query()和Cookie,你还记得吧。现在的问题是:
一、为什么一点击按钮浏览器就死了“没有响应”
两个按钮对应的两个事件分别为:
事件一:
private void button2_Click(object sender, RoutedEventArgs e)
{
//传递参数给Asp.net页面
HtmlPage.Window.Eval("location='" +
Application.Current.Host.Source.AbsoluteUri.Replace(
Application.Current.Host.Source.AbsolutePath, "") + "/index.aspx?id=203';");
}
事件二:
private void button1_Click(object sender, RoutedEventArgs e)
{ //编写一个键为FirCookieKey,值为FirCookieValue的Cookie
string oldCookie = HtmlPage.Document.GetProperty("cookie") as String;
DateTime expiration = DateTime.UtcNow + TimeSpan.FromDays(2000);
string cookie = String.Format("{0}={1};expires={2}", "FirCookieKey",
"FirCookieValue", expiration.ToString("R"));
HtmlPage.Document.SetProperty("cookie", cookie);
//跳转界面
HtmlPage.Window.Eval("location='" +
Application.Current.Host.Source.AbsoluteUri.Replace(
Application.Current.Host.Source.AbsolutePath, "") + "/index.aspx';");}
一点击按钮,浏览器就死了,“没有响应”,怎么回事,那里不对吗?问题二:
private void button2_Click(object sender, RoutedEventArgs e)
{
//传递参数给Asp.net页面
HtmlPage.Window.Eval("location='" +
Application.Current.Host.Source.AbsoluteUri.Replace(
Application.Current.Host.Source.AbsolutePath, "") + "/index.aspx?id=203';");
}这句代码实现的功能是什么,什么作用???问题三:
项目总是从“SLConnectASP.NETTestPage.html”启动。想把启动页改为“Index.aspx”。可是修改不了,“Set As Start Page了”,可是还是不行,怎么回事。
一、为什么一点击按钮浏览器就死了“没有响应”
两个按钮对应的两个事件分别为:
事件一:
private void button2_Click(object sender, RoutedEventArgs e)
{
//传递参数给Asp.net页面
HtmlPage.Window.Eval("location='" +
Application.Current.Host.Source.AbsoluteUri.Replace(
Application.Current.Host.Source.AbsolutePath, "") + "/index.aspx?id=203';");
}
事件二:
private void button1_Click(object sender, RoutedEventArgs e)
{ //编写一个键为FirCookieKey,值为FirCookieValue的Cookie
string oldCookie = HtmlPage.Document.GetProperty("cookie") as String;
DateTime expiration = DateTime.UtcNow + TimeSpan.FromDays(2000);
string cookie = String.Format("{0}={1};expires={2}", "FirCookieKey",
"FirCookieValue", expiration.ToString("R"));
HtmlPage.Document.SetProperty("cookie", cookie);
//跳转界面
HtmlPage.Window.Eval("location='" +
Application.Current.Host.Source.AbsoluteUri.Replace(
Application.Current.Host.Source.AbsolutePath, "") + "/index.aspx';");}
一点击按钮,浏览器就死了,“没有响应”,怎么回事,那里不对吗?问题二:
private void button2_Click(object sender, RoutedEventArgs e)
{
//传递参数给Asp.net页面
HtmlPage.Window.Eval("location='" +
Application.Current.Host.Source.AbsoluteUri.Replace(
Application.Current.Host.Source.AbsolutePath, "") + "/index.aspx?id=203';");
}这句代码实现的功能是什么,什么作用???问题三:
项目总是从“SLConnectASP.NETTestPage.html”启动。想把启动页改为“Index.aspx”。可是修改不了,“Set As Start Page了”,可是还是不行,怎么回事。
我想这个有点“漂移”。你的silverlight代码让浏览器客户端当前页面都重定向了,如果只是为了“交互”的目的,这样做就有点不实际。