郁闷的要死!谁能帮我一下?谢谢啦

ts230 2010-05-31 12:00:44
我写了一个Web部件,用系统账户登录的话就可以,但是用表单(程序集管理员账户)登录的话就报错。。。。。

...全文
70 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
Justin-Liu 2010-06-02
  • 打赏
  • 举报
回复
结贴啊那。。。
ts230 2010-06-02
  • 打赏
  • 举报
回复
好吧,结贴。
我换成SharePoint自带的富文本编辑控件了。。。。
jackyzsy2008 2010-06-01
  • 打赏
  • 举报
回复
报的什么错?详细错误信息是?
zhangjun 2010-05-31
  • 打赏
  • 举报
回复
修改web.config文件,把它的trust的level改成Full试试
sonce8 2010-05-31
  • 打赏
  • 举报
回复
FreeTextBoxControls.FreeTextBox 是第三方控件??
如果是的话,你在web.config有没有加入safecontrol里面?
chenminghong 2010-05-31
  • 打赏
  • 举报
回复
我也想了解
我的系统也要切换成from认证,不知道会不会出现问题。
ts230 2010-05-31
  • 打赏
  • 举报
回复

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using Microsoft.SharePoint;

namespace DiyWebPart.Part
{
public class DeleteTask : WebPart, INamingContainer
{
private FreeTextBoxControls.FreeTextBox _FreeTestBox = new FreeTextBoxControls.FreeTextBox()
{
Width = Unit.Parse("629"),
Height = Unit.Parse("200"),
EnableHtmlMode = false,
Language = "zh-CN",
ToolbarLayout = "ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu;"
+"Bold,Italic,Underline;JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;"
+"BulletedList,NumberedList;CreateLink,InsertImage"
};
}
}


这样写的话就会报错,只有系统用户登录的时候才不会报错

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using Microsoft.SharePoint;

namespace DiyWebPart.Part
{
public class DeleteTask : WebPart, INamingContainer
{
}
}

这样写的话就可以,


为什么呢》》》》》》?是权限问题么?
我使用表单验证的时候,用程序集管理员admin账户登录也是一样报错,
但是,我使用windows验证,用系统账户登录的时候就不报错。。。。
Oo云 2010-05-31
  • 打赏
  • 举报
回复
SPSecurity.RunWithElevatedPrivileges(delegate() //用此方法模拟管理员账户运行此处理程序
{
}
用这个 把代码 抱起来
Justin-Liu 2010-05-31
  • 打赏
  • 举报
回复
F10调一下
ts230 2010-05-31
  • 打赏
  • 举报
回复

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using Microsoft.SharePoint;

namespace DiyWebPart.Part
{
public class DeleteTask : WebPart, INamingContainer
{
private HtmlTableCell _HtmlTableCell = new HtmlTableCell();
private CheckBox _CheckBox = new CheckBox()
{
Text = "是",
Checked = true
};
private FreeTextBoxControls.FreeTextBox _FreeTestBox = new FreeTextBoxControls.FreeTextBox()
{
Width = Unit.Parse("629"),
Height = Unit.Parse("200"),
EnableHtmlMode = false,
Language = "zh-CN",
ToolbarLayout = "ParagraphMenu,FontFacesMenu,FontSizesMenu,FontForeColorsMenu;Bold,Italic,Underline;JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,NumberedList;CreateLink,InsertImage"
};
private Button _Button = new Button()
{
Width = Unit.Parse("89"),
Text = "拒绝任务"
};
public DeleteTask()
{
this._Button.Click += new EventHandler(_Button_Click);
}

void _Button_Click(object sender, EventArgs e)
{
//base.Page.Response.Redirect();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.Page.IsPostBack == true)
{
this.AddControls();
}
}
protected override void CreateChildControls()
{
this.Controls.Add(new LiteralControl("<table>" + "\n"));

this.Controls.Add(new LiteralControl(" <tr>" + "\n"));

this.Controls.Add(this._HtmlTableCell);

this.Controls.Add(new LiteralControl(" </tr>" + "\n"));

this.Controls.Add(new LiteralControl("</table>" + "\n"));



if (this.Page.IsPostBack == false) this.AddControls();


}
//画表单
private void AddControls()
{
//得到登录的用户名
string loginName = base.Page.User.Identity.Name;
base.Page.ClientScript.RegisterStartupScript(this.GetType(), "checkClick", "<script>function checkClick(ob){ if(ob.checked==false) {document.getElementById(\"div1\").style.display=\"block\";} else{document.getElementById(\"div1\").style.display=\"none\";} }</script>");
this._HtmlTableCell.Controls.Add(new LiteralControl("<table width='639px'>" + "\n"));
//第一行
this._CheckBox.Attributes.Add("onclick", "checkClick(this)");//document.getElementById('text1').style.display=block;");
this._HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl(" <td>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl("是否同意此任务申请:"));
this._HtmlTableCell.Controls.Add(this._CheckBox);
this._HtmlTableCell.Controls.Add(new LiteralControl(" </td>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl(" </tr>" + "\n"));

//第二行
this._HtmlTableCell.Controls.Add(new LiteralControl(" <tr>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl(" <td>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl(" <div id=\"div1\" style=\"display:none;\"><div id=\"div2\" style=\"padding-top:15px;float:left;\">拒绝理由:</div>" + "\n<div id=\"div3\">"));
this._HtmlTableCell.Controls.Add(this._FreeTestBox);
this._HtmlTableCell.Controls.Add(new LiteralControl("</div><br/><br/><div style=\"padding-left:543px;\">"));
this._HtmlTableCell.Controls.Add(this._Button);
this._HtmlTableCell.Controls.Add(new LiteralControl(" </div></div>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl(" </td>" + "\n"));
this._HtmlTableCell.Controls.Add(new LiteralControl(" </tr>" + "\n"));
//第九行
}
}
}

Michael193 2010-05-31
  • 打赏
  • 举报
回复
你的Web Part实现了什么功能?代码可以贴出来嘛?

3,242

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 SharePoint
社区管理员
  • SharePoint社区
  • 霖雨
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧