SharePoint 改动passwordWeb Part部署方案
版权声明:本文为博主原创文章。未经博主同意不得转载。
https://blog.csdn.net/u012025054/article/details/31773231
SharePoint 改动passwordWeb Part部署方案
填写预调试网站,点击验证。验证成功后,选择“部署为场解决方式”。点击确定。
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace changePWD.passwordChange
{
[ToolboxItemAttribute(false)]
public class passwordChange : WebPart
{
// 当更改可视 Web 部件项目项时,Visual Studio 可能会自己主动更新此路径。
private const string _ascxPath = @"~/_CONTROLTEMPLATES/changePWD/passwordChange/passwordChangeUserControl.ascx";
public string _domainName;
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[Category("自己定义设置")]
[WebDisplayName("请输入域server的计算机全名。
如smallville-pc")]
public string DomainName
{
get { return _domainName ?
? (_domainName = "smallville-pc"); }//这里是域名
set { _domainName = value; }
}
protected override void CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
}
}
}
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="passwordChangeUserControl.ascx.cs" Inherits="changePWD.passwordChange.passwordChangeUserControl" %>
更改password注意事项:
1.password必须包括下面三部分:字母,数字,特殊符号
2.password长度必须大于6位
3.新password不能与近期5次使用的password同样
4.一天之内仅仅同意改动一次password。
5.password改动后有5分钟的缓冲时间。5分钟后旧password作废。
6.发生更改password遗失,请联系系统管理员
7.联系邮箱ContactMe@126.com
| username: | ||
| 输入旧password | ||
| 输入新password | ||
| 再次输入新password | ||
|
|
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Security;
using System.DirectoryServices.AccountManagement;
using Microsoft.SharePoint;
namespace changePWD.passwordChange
{
public partial class passwordChangeUserControl : UserControl
{
#region 字符串
string domainName = string.Empty;
string logName = string.Empty;
string splited = string.Empty;
#endregion
#region methods
protected void Page_Load(object sender, EventArgs e)
{
domainName = ((passwordChange)Parent).DomainName;
logName = SPContext.Current.Web.CurrentUser.LoginName;
if (logName.IndexOf("\\") >= 0)
{
splited = logName.Split('\\')[1];
}
SplitedLabel.Text = splited;
}
#region 主要功能实现
protected void OKButton_Click(object sender, EventArgs e)
{
string oldpwd = OldCode.Text;
string newpwd = NewCode2.Text;
OKButton.Page.Validate();
if (OKButton.Page.IsValid)
{
try
{
PrincipalContext context = new PrincipalContext(ContextType.Domain, domainName, splited, oldpwd);
UserPrincipal currentPrincipal = UserPrincipal.FindByIdentity(context, splited);
SPSecurity.RunWithElevatedPrivileges(delegate() //提升权限运行
{
currentPrincipal.ChangePassword(oldpwd, newpwd);
currentPrincipal.Save();
});
StaLabel.Text = "password改动成功";
}
catch (PasswordException pder)
{
StaLabel.Text = "PWD:[" + pder.Message + "]";
}
catch (Exception aner)
{
StaLabel.Text = "password改动错误:[" + aner.Message + "]";
}
}
else
{
StaLabel.Text = "按提示更改所填信息";
}
}
#endregion
protected void ClearButton_Click(object sender, EventArgs e)
{
OldCode.Text = string.Empty;
NewCode1.Text = string.Empty;
NewCode2.Text = string.Empty;
}
#endregion
}
}
6. 点击生成菜单。选择部署解决方式.
SharePoint 改动passwordWeb Part部署方案的更多相关文章
- redis从入门到放弃 -> 部署方案
单点部署方案 环境准备: [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@ ...
- eql高可用部署方案
运行环境 服务器两台(后面的所有配置案例都是以10.96.0.64和10.96.0.66为例) 操作系统CentOS release 6.2 必须要有共同的局域网网段 两台服务器都要安装keepali ...
- virtual judge 本地部署方案
这是一种将自己的电脑当作服务器来部署一个vj的方法,我也是参考前辈们的做法稍作了改动,如果在服务器上部署的话需要在细节上稍作改动: 一.什么是Virtual Judge? vj的工作原理什么? vj ...
- Kubernetes常见的部署方案(十四)
一.常见的部署方案 滚动更新 服务不会停止,但是整个pod会有新旧并存的情况. 重新创建 先停止旧的pod,然后再创建新的pod,这个过程服务是会间断的. 蓝绿 (无需停机,风险较小) 部署v1的应用 ...
- Neutron 物理部署方案 - 每天5分钟玩转 OpenStack(68)
前面我们讨论了 Neutron 的架构,本节讨论 Neutron 的物理部署方案:不同节点部署不同的 Neutron 服务组件. 方案1:控制节点 + 计算节点 在这个部署方案中,OpenStack ...
- iOS应用动态部署方案
iOS的动态部署能极大的节约成本.苹果的审核周期很长,有的时候,你可能不得不等待将近2个星期去上架你的新功能或者bug.所以动态部署是有价值的. 我这里讨论的情况不把纯web应用考虑在内,因为用户体验 ...
- ActiveMQ实现负载均衡+高可用部署方案
一.架构和技术介绍 1.简介 ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.完全支持JMS1.1和J2EE 1.4规范的JMS Provider实现 2.activemq的特 ...
- spring boot 自动部署方案
现在主流的自动部署方案大都是基于Docker的了,但传统的自动部署方案比较适合中小型公司,下面的方案就是比较传统的自动部署方案. 1.为什么需要自动部署 基于微服务的架构,自动部署显得非常重要.因为每 ...
- Memcached常规应用与分布式部署方案
1.Memcached常规应用 $mc = new Memcache(); $mc->conncet('127.0.0.1', 11211); $sql = sprintf("SELE ...
随机推荐
- web前端开发教程系列-3 - 前端开发调试工具分享
前言 一. Bug出现的原因 1. 主观原因或者是出现这么多浏览器的原因 2. 另外客观原因: 二. 调试工具 1. Firebug 2. Chrome 3. IE11 4. IETester 5. ...
- 解决部分小程序无法获取UnionId的问题
问题背景 通过观察数据,发现有一部分用户是无法获取到UnionId的 也就是接口返回的参数中不包含UnionId参数 看了微信文档的解释,只要小程序在开放平台绑定,就一定会分配UnionId 网上也有 ...
- 项目托管到Github上
一.注册github账号 首先需要注册一个github账号,注册地址:https://github.com 接着会来到这 然后会收到一封github发的邮件,进入邮箱验证 二.创建个人的githu ...
- 手把手教你写一个java的orm(三)
使用反射解析class 上一篇我们完成了class到表映射关系的建立,但是这个并不能被代码正确处理,我们还需要让程序能够正确的识别这些映射关系. 这一篇主要讲的是建立一个从class到表的模型,使我们 ...
- Java计算两个经纬度间的距离最简单的方式
开发中经常会遇到计算两个点(经纬度)之间的距离或者计算最近门店的场景,下面简单实现一下如何计算两个经纬度之间相隔的距离. 1.导入geodesy的maven依赖 或者到阿里云maven仓库下载jar包 ...
- Mybatis之reflection包源代码解析(一)
一.序言 Mybatis作为ORM,实现了对象与关系数据库间的映射.Mybatis中的映射包含两个方面: 1.将对象中的值(parameterType所指定的对象)映射到具体的sql中,例如: & ...
- Spring学习手札(三)理解IoC 拯救不开心
Inverse of Control,翻译成“控制反转”,是Spring的核心.IoC不是一种技术,而是一种设计思想.就是将原本在程序中手动创建对象的控制权(new Object() ),交由Spri ...
- 有趣:256个class选择器可以干掉1个id选择器——张鑫旭
我们应该都知道,从选择器得分权重上将,id选择器(#aaa{})和class选择器(.aaa{})完全不是一个数量级的,前者:1-0-0; 而后者为0-1-0.因此: #id { color:dark ...
- C语言程序设计基础知识点概括
C语言程序设计基础知识点概括 C语言程序设计基础知识点1.函数是C语言的基本构成单位.main函数是C语言程序的唯一入口.2.C语言程序开发过程. 编译过程:将以.c或.cpp结尾的源程序文件经过编译 ...
- 浅析javascript高阶函数
什么是高阶函数:在数学和计算机科学中,高阶函数是至少满足下列一个条件的函数: 1. 接受一个或多个函数作为输入: 2. 输出一个函数.在数学中它们也叫做算子(运算符)或泛函.微积分中的导数就是常见的例 ...