【问题标题】:Need inputs for logic for Codebehind in Infopath Button需要信息路径按钮中代码隐藏的逻辑输入
【发布时间】:2011-09-19 07:36:34
【问题描述】:

我有一个信息路径表单,当我单击按钮时,它应该重定向到共享点列表项的添加项模板。在我给出的代码中

 try
 {
  string url = "Sharepoint List item's URL";
  HttpContext.Current.Response.Redirect("url");
  }
  catch
  {
  }

但我收到这样的安全错误

System.Security.SecurityException 请求“System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限失败。 在 Activity_Profile.FormCode.btnNewReportingUnit_Clicked(对象发送者,ClickedEventArgs e) 在 Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent) 在 Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

请帮帮我:)

【问题讨论】:

  • 即使在 URL 字段中,如果我提供 www.google.com 我也会遇到同样的错误......使用 HttpContext.Current.Response.Redirect("url");

标签: c# sharepoint-2010 infopath infopath2010


【解决方案1】:

尝试以下方法:

  • 尝试使用HttpContext.Current.Response.Redirect("url", false);
  • 确保引用 System.Web 并为其添加导入语句
  • 检查您的表单安全性是否设置为完全信任

我认为这与没有完全信任的表单有关,因此不允许在任何地方重定向。

【讨论】:

  • Moontear 我在 HttpContext.Current.Response.Redirect("url", false) 处获取对象引用未设置为对象实例;我已将 System.Web 和安全性添加为完全信任
  • 使用变量而不是 "url" 会有什么不同吗?喜欢 myVar.toString()?
  • 我用一些隐藏的文本框解决问题...感谢您的支持:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-03
  • 1970-01-01
  • 2012-08-19
  • 1970-01-01
  • 2020-07-05
相关资源
最近更新 更多