+ -
当前位置:首页 → 问答吧 → 调用ClickOnce部署的应用程序的怪异问题

调用ClickOnce部署的应用程序的怪异问题

时间:2011-12-05

来源:互联网

提要:

1、我使用ClickOnce部署了一个应用程序,发布时采用允许给应用程序传递URL参数,并在测试窗体中,使用System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri.OriginalString方法来获取激活该应用程序的URL地址。该应用程序发布的访问位置为:http://localhost/ckTest/ckTest.application

2、我使用一个测试的website,在启动页面中放置了一个按钮,按钮的事件处理如下:

 C# code
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("http://localhost/ckTest/ckTest.application?idcard=111");
    }



3、我的website访问的地址为:http://localhost/webTest/Default.aspx

 问题来了:

通过访问http://localhost/webTest/Default.aspx,点击页面按钮,启动ckTest应用程序,获得的
ApplicationDeployment.CurrentDeployment.ActivationUri.OriginalString为:http://localhost/ckTest/ckTest.application?idcard=111,一切正常,OK。

 

然后,在Default页面的Load事件中也加入了如下处理代码:

C# code
    protected void Page_Load(object sender, EventArgs e)
    {
Response.Redirect("http://localhost/ckTest/ckTest.application?idcard=111");
    }
 


通过访问http://localhost/webTest/Default.aspx,启动了ckTest应用程序,获得的
ApplicationDeployment.CurrentDeployment.ActivationUri.OriginalString为:http://localhost/webTest/Default.aspx,而不是http://localhost/ckTest/ckTest.application?idcard=111,让我很纳闷。

请高手释疑!!!

ps:我用的是VS2005,想实现的是,通过一个页面后台获取需要传递的参数,然后传给应用程序使用,不需要通过按钮点击事件,而是自动跳转的方式。

作者: mxchbl   发布时间: 2011-12-05

没有高手啊。。。。。

作者: mxchbl   发布时间: 2011-12-14