小编Ale*_*gas的帖子

Web.HttpContext.Current.User.Identity.Name来自哪里?

我有

FormsAuthentication.SetAuthCookie("someName", True)
Run Code Online (Sandbox Code Playgroud)

作为我的自定义登录序列的一部分.后来,我有一些页面只允许一个特定的角色:

<location path="myPage.aspx">
    <system.web>
        <authorization>
            <allow roles="SomeRole"/>
            <deny users="*"/>
        </authorization>
    </system.web>
</location>
Run Code Online (Sandbox Code Playgroud)

据我所知,这会调用我的角色提供程序的GetRolesForUser实现.它似乎从Web.HttpContext.Current.User.Identity.Name获取用户名参数.

我的问题是...... 来自auth cookie的用户名何时被设置为我当前用户身份中的名称?

asp.net forms-authentication httpcontext roleprovider

5
推荐指数
1
解决办法
9563
查看次数

Sharepoint 2007 AddList和AddListFromFeature缺少模板列和数据内容

我做了什么

  • 在SharePoint内部,我基于Project Tasks模板创建了一个List
  • 我删除了大多数默认列,并添加了新的自定义列
  • 我使用新格式添加了数据
  • 然后我做了"另存为模板",并选择使用内容保存模板

什么是工作

现在,当我使用该模板在SharePoint中创建一个新的List时,它可以完美地运行.存在自定义列,并且数据全部按预期填充.

什么不工作

但是,当我使用SharePoint Web服务提供的AddListAddListFromFeature方法时,会创建新列表,但它只是基于原始Project Tasks模板,具有默认列没有数据!

我试过的

系统设置

使用SharePoint 2007(我认为?),使用PHP与NuSOAP进行连接.连接肯定有效,因为我已经将项目添加到列表,创建列表和读取数据.

代码示例

请求 - 针对上面的阶段2方法模板

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2034="http://tempuri.org"><SOAP-ENV:Body>
<AddListFromFeature xmlns="http://schemas.microsoft.com/sharepoint/soap/">
    <listName>2Test Milestone Release</listName>
    <description>Testing this out</description>
    <featureID>{00BFEA71-513D-4CA0-96C2-6A47775C0119}</featureID>
    <templateID>151</templateID>
</AddListFromFeature></SOAP-ENV:Body></SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)

响应 - 由于未识别templateID而失败

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Cannot complete this action.

Please try again.</errorstring><errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x81072101</errorcode></detail></soap:Fault></soap:Body></soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

我很难过!所以,如果你能提供帮助 …

sharepoint moss web-services sharepoint-2007

5
推荐指数
1
解决办法
1719
查看次数

从Visual Studio在浏览器中加载搜索URL

我发现内置的Visual Studio Document Explorer不太相关,特别是因为我使用的更多SDK具有最新的在线内容.按F1启动文档资源管理器通常会有一些无用的东西,它对我来说不再可用.

在Visual Studio中按键组合时是否有任何方法:

  • 默认浏览器将打开搜索引擎的URL
  • query used是当前光标位置下的关键字
  • 添加一个过滤器,如 site:msdn.microsoft.com

我对VS中的宏一无所知,但据推测这就是我需要的.有谁知道如何设置它?teh codez会很好!

macros msdn visual-studio

5
推荐指数
1
解决办法
712
查看次数

将字符串转换为 DataColumn 中的 guid

如何将设置为类型的 GUID 的 DataColumn 转换为类型string为 的 GUID 的 DataColumn Guid?源数据中的一列类型错误,我无法在那里更改它。

.net c# datacolumn

5
推荐指数
1
解决办法
3232
查看次数

在WCF中传递DefaultCredentials相当于什么?

这个答案解释了在调用.asmx Web服务时,无需指定要使用的身份验证类型:


WebServiceProxy proxy = new WebServiceProxy(); // Derived from SoapHttpClientProtocol

proxy.Credentials = CredentialCache.DefaultCredentials;
Run Code Online (Sandbox Code Playgroud)

此方法适用于NTLM和Kerberos身份验证.它将传递运行代码的Windows帐户的凭据.


WCF中的等价物是什么,适用于NTLM和Kerberos环境?

wcf ntlm kerberos credentials

5
推荐指数
1
解决办法
5035
查看次数

初始化SharePoint后执行JavaScript函数

我有一个自定义的JS脚本,我加载到SharePoint中,并且在SP完成自己的初始化之后有问题要让我的init方法执行.

_spBodyOnLoadFunctionNames

我首先尝试了"官方"方式,并在加载后将我的函数名称添加到已执行函数列表中,_spBodyOnLoadFunctionNames.push("myInitMethod");但是不会在每次加载页面时触发,我不能依赖它.

ExecuteOrDelayUntilScriptLoaded

然后我尝试使用ExecuteOrDelayUntilScriptLoaded(myInitMethod, "sp.js");函数,但它不会在每个页面加载时触发.

两种方式都有效 - 但不是每次都有效.我假设初始化SP 之前有时会加载我的脚本.这主要发生在Chrome上,但也发生在IE上.

如何在SP准备好后确保我的脚本执行?


注意:加载页面并且SP对象未完全初始化时会有一个有趣的行为(ExecuteOrDelayUntilScriptLoaded中的已注册函数尚未被调用):只要我点击页面中的"向上导航"锚点(你在哪里)可以看到subites的hiarchy)以下文件被加载并且我的init函数(在ExecuteOrDelayUntilScriptLoaded中注册)被调用!

  • core.debug.js
  • sp.core.debug.js
  • ScriptResx.ashx
  • sp.ui.dialog.debug.js
  • sp.runtime.debug.js
  • sp.debug.js

所以在点击之后一切都很好 - 但为什么不在页面加载上呢?

javascript sharepoint sharepoint-2010

5
推荐指数
1
解决办法
2万
查看次数

使用Font Squirrel生成的字体不会显示在IE 9中

我使用Fontsquirrel @fontface Generator为我正在使用的三种字体创建CSS.字体在每个浏览器中都能正常显示,包括其他版本的IE - 但IE 9没有显示字体.

这是CSS:

    @font-face {
    font-family: "OswaldBold";
    src: url("../fonts/oswald-bold-webfont.eot");
    src: url("../fonts/oswald-bold-webfont.eot?#iefix") format("embedded-opentype"),
         url("../fonts/oswald-bold-webfont.woff") format("woff"),
         url("../fonts/oswald-bold-webfont.ttf") format("truetype"),
         url("../fonts/oswald-bold-webfont.svg#OswaldBold") format("svg");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "OswaldRegular";
    src: url("../fonts/oswald-regular-webfont.eot");
    src: url("../fonts/oswald-regular-webfont.eot?#iefix") format("embedded-opentype"),
         url("../fonts/oswald-regular-webfont.woff") format("woff"),
         url("../fonts/oswald-regular-webfont.ttf") format("truetype"),
         url("../fonts/oswald-regular-webfont.svg#OswaldRegular") format("svg");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "OswaldLight";
    src: url("../fonts/oswald-light-webfont.eot");
    src: url("../fonts/oswald-light-webfont.eot?#iefix") format("embedded-opentype"),
         url("../fonts/oswald-light-webfont.woff") format("woff"),
         url("../fonts/oswald-light-webfont.ttf") format("truetype"),
         url("../fonts/oswald-light-webfont.svg#OswaldLight") format("svg");
    font-weight: normal;
    font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

...以下是我在IE开发人员控制台中遇到的错误:

CSS3111:@ font-face遇到未知错误.
奥斯瓦尔德-光webfont.eot?#iefix

CSS3111:@ font-face遇到未知错误.
奥斯瓦尔德-粗体webfont.eot?#iefix

CSS3111:@ font-face遇到未知错误.
奥斯瓦德-光webfont.woff

CSS3111:@ font-face遇到未知错误. …

font-face internet-explorer-9

5
推荐指数
1
解决办法
1万
查看次数

索引和长度必须引用子字符串中字符串错误中的位置

我有一个这样的字符串:2899 8761 014 00:00:00 06/03/13 09:35 G918884770707.我必须G918884770707从这个给定的字符串中获取子字符串.我知道子字符串的开头所以我把子字符串的结尾作为整个字符串的长度,如下所示:

 No = line.Substring(Start,End);
Run Code Online (Sandbox Code Playgroud)

这里Start的值是39和主字符串的长度,52所以这是End的值.

这会导致错误:

索引和长度必须引用子字符串中字符串错误中的位置

我该如何解决这个问题?

.net c# string substring string-length

5
推荐指数
1
解决办法
2万
查看次数

没有对话框提示的ADAL身份验证

我在Azure AD中注册了一个连接到CRM Online的控制台应用程序(使用这些步骤配置).它查询Web API.

应用程序需要在没有用户交互的情况下运行...但不幸的是,调用AcquireTokenSilentAsync总是失败并且只能AcquireTokenAsync运行.这会使用户登录对话框出现,但无法满足用户交互要求!

有没有办法阻止这个提示,要么通过在客户端机器上保存登录(到目前为止没有工作)或者可能使用证书(但你怎么做?)或其他什么?

我正在使用ADAL for .NET v3.10.305110106版本.以下代码用于验证:

private static async Task PerformOnlineAuthentication()
{
    _authInfo = new AuthInfo();  // This is just a simple class of parameters

    Console.Write("URL (include /api/data/v8.x): ");
    var url = Console.ReadLine();

    BaseUri = new Uri(url);
    var absoluteUri = BaseUri.AbsoluteUri;
    _authInfo.Resource = absoluteUri;

    Console.Write("ClientId: ");
    var clientId = Console.ReadLine();
    _authInfo.ClientId = clientId;

    Console.Write("RedirectUri: ");
    var redirectUri = Console.ReadLine();
    _authInfo.RedirectUri = new Uri(redirectUri);

    var authResourceUrl = new Uri($"{_authInfo.Resource}/api/data/"); …
Run Code Online (Sandbox Code Playgroud)

dynamics-crm azure dynamics-crm-online azure-active-directory adal

5
推荐指数
1
解决办法
3894
查看次数

应该何时将类成员声明为虚拟(C#)/ Overridable(VB.NET)?

为什么我不选择抽象?声明类成员虚拟有哪些限制?只能将方法声明为虚拟?

.net c# vb.net

4
推荐指数
1
解决办法
1万
查看次数