小编Pan*_*cus的帖子

HTTP请求未经授权使用客户端身份验证方案'Ntlm'从服务器收到的身份验证头是'NTLM'

我知道有很多关于SO的问题与此类似,但我找不到这个问题.

有几点,第一点:

  • 无法控制我们的Sharepoint服务器.我无法调整任何IIS设置.
  • 我相信我们的IIS服务器版本是IIS 7.0.
  • 我们的Sharepoint Server正在通过NTLM预测请求.
  • 我们的Sharepoint服务器与我的客户端计算机位于同一个域中.
  • 我使用的是.NET Framework 3.5,Visual Studio 2008

我正在尝试编写一个简单的控制台应用程序来使用Sharepoint Web Services操作Sharepoint数据.我添加了服务参考,以下是我的app.config:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="ListsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="Transport">
                    <transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://subdomain.companysite.com/subsite/_vti_bin/Lists.asmx"
            binding="basicHttpBinding" bindingConfiguration="ListsSoap"
            contract="ServiceReference1.ListsSoap" name="ListsSoap" />
    </client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

static void Main(string[] args)
{
    using (var client = new ListsSoapClient())
    {
        client.ClientCredentials.Windows.ClientCredential = new …
Run Code Online (Sandbox Code Playgroud)

.net c# authentication sharepoint ntlm

49
推荐指数
3
解决办法
10万
查看次数

有没有办法在SQL Server Management Studio Express 2005的查询编辑器中查看空格?

我在Visual Studio 2008中启用了它,但我真的想在SQL Server Management Studio 2005 Express中启用此功能.有谁知道它可能吗?也许在以后的版本?

编辑:对不起,我的意思是在文本/查询编辑器中.

ide whitespace ssms sql-server-2005

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

在C#.NET 2.0中,反向执行foreach的简单方法是什么?

假设我有一个Dictionary对象:

Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();
Run Code Online (Sandbox Code Playgroud)

现在我想以相反的顺序遍历字典.我不能使用简单的for循环,因为我不知道字典的键.一的foreach很简单:

foreach (SomeObject object in myDictionary.Values)
{
    // Do stuff to object
}
Run Code Online (Sandbox Code Playgroud)

但是我怎么能反向执行呢?

.net c# iteration collections

16
推荐指数
3
解决办法
2万
查看次数

一串英文文本的熵如何表示低质量?

杰夫阿特伍德最近发布了一个链接到CodeReview帖子,他想知道社区是否可以改善他的" 计算字符串熵 "代码片段.他解释说,"我们正在计算Stack Overflow中几个字符串的熵,作为低质量的标志."

他的方法的要点似乎是,如果计算字符串中唯一字符的数量,则表示熵(代码取自PieterG的答案):

int uniqueCharacterCount = string.Distinct().Count();
Run Code Online (Sandbox Code Playgroud)

我不明白唯一字符数如何表示字符串的熵,以及字符串的熵如何表示低质量.我想知道在这方面有更多知识的人是否可以解释阿特伍德先生想要完成的事情.

谢谢!

computer-science entropy information-theory

13
推荐指数
2
解决办法
7372
查看次数

使用XSLT的.NET扩展对象 - 如何迭代集合?

帮帮我,Stackoverflow!

我有一个简单的.NET 3.5控制台应用程序,它可以读取一些数据并发送电子邮件.我在XSLT样式表中表示电子邮件格式,以便我们可以轻松更改电子邮件的措辞,而无需重新编译应用程序.

我们在应用转换时使用扩展对象将数据传递给XSLT:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
    xmlns:EmailNotification="ext:EmailNotification">
Run Code Online (Sandbox Code Playgroud)

- 这样,我们可以有这样的陈述:

<p>
    Dear <xsl:value-of select="EmailNotification:get_FullName()" />:
</p>
Run Code Online (Sandbox Code Playgroud)

以上工作正常.我通过这样的代码传递对象(为简洁起见省略了一些不相关的代码):

// purely an example structure
public struct EmailNotification
{
    public string FullName { get; set; }
}

// Somewhere in some method ... 

var notification = new Notification("John Smith");

// ...

XsltArgumentList xslArgs = new XsltArgumentList();
xslArgs.AddExtensionObject("ext:EmailNotification", notification);

// ...

// The part where it breaks! (This is where we do the transformation)
xslt.Transform(fakeXMLDocument.CreateNavigator(), xslArgs, XmlWriter.Create(transformedXMLString));
Run Code Online (Sandbox Code Playgroud)

所以,以上所有代码都有效.但是,我想得到一点点幻想(总是我的垮台)并传递一个集合,这样我就能做到这样的事情:

<p>The following …
Run Code Online (Sandbox Code Playgroud)

.net c# email xslt

10
推荐指数
1
解决办法
7409
查看次数

编译器优化匿名类型

好的,我知道这是一个黑客,但这是一个小小的数据操作项目,我想玩.;-)

我一直认为编译器会检查C#程序中使用的所有匿名类型,如果属性相同,它只会在幕后创建一个类.

所以我想说我想用一些类型化的数据集创建一个匿名类型:

var smallData1 = new smallData1().GetData().Select(
    x => new { Name = x.NAME, x.ADDRESS, City = x.CITY, State = x.STATE,
    Zip = x.ZIP, Country = x.COUNTRY, ManagerName = x.MANAGER_NAME,
    ManagerID = x.MANAGER_ID });

var smallData2 = new smallData2().GetData().Select(
    x => new { x.Name, x.ADDRESS, x.City, x.State, x.Zip, x.Country,
    x.ManagerName,x.ManagerID });
Run Code Online (Sandbox Code Playgroud)

我现在可以做一些有趣的事情,比如smallData2.Except(smallData1); 等等,一切正常.

现在,如果我有一对更大的匿名类型怎么办:

var bigData1 = new BigAdapter1().GetData().Select(
    x => new { x.FirstName, x.LastName, x.Address, x.City, x.State,
    x.Zip, x.Country, x.Phone, x.Email, x.Website, x.Custom1, x.Custom2,
    x.Custom3, x.Custom4, x.Custom5, …
Run Code Online (Sandbox Code Playgroud)

c# anonymous-types .net-4.0 compiler-optimization

7
推荐指数
1
解决办法
392
查看次数

'适当'集合用于在C#.NET中获取O(1)时间内的项目?

如果我存储了一堆字符串值并且我希望能够在O(1)之后找到它们,我经常做的事情是:

foreach (String value in someStringCollection)
{
    someDictionary.Add(value, String.Empty);
}
Run Code Online (Sandbox Code Playgroud)

这样,我可以在以后轻松对这些字符串值执行常量时间查找,例如:

if (someDictionary.containsKey(someKey))
{
    // etc
}
Run Code Online (Sandbox Code Playgroud)

但是,我觉得我在制作值String.Empty时作弊.我应该使用更合适的.NET Collection吗?

.net c# string collections optimization

6
推荐指数
1
解决办法
461
查看次数

在VS 2003中,如何在每次调试时禁止部署.NET CF 1.0?

我(不幸的是)使用VS 2003开发了一些Windows CE .NET 4.1移动设备.该应用程序是用.NET Compact Framework 1.0编写的(操作系统不支持任何更高版本的.NET CF).

每当我从Visual Studio运行我的应用程序时,它都会复制/尝试将.NET CF 1.0安装到我的设备:

Copying netcf.all.wce4.armv4t.cab
Run Code Online (Sandbox Code Playgroud)

复制需要很长时间,最后设备会问我是否要重新安装(我总是说'不').

由于这需要很长时间才能复制,因此我希望每次点击"debug"时都指示VS 2003 复制文件.有没有办法以这种方式更改我的部署设置?

谢谢!!

.net compact-framework visual-studio-2003 .net-1.0

6
推荐指数
1
解决办法
298
查看次数

Management Studio如何知道保存我的T-SQL注释?

我对SQL Server Management Studio保存视图,存储过程等注释的方式感到困惑.

假设我正在改变视图,并在ALTER语句之前添加了一些注释:

USE [SomeDatabase]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- Let's add some comments about this view!
ALTER VIEW [dbo].[MyView]
AS
SELECT Stuff
FROM   TableOfStuff
-- To get the other stuff, we have to do an inner join
INNER JOIN OtherStuff
ON     TableOfStuff.OtherKey = OtherStuff.StuffKey

GO
Run Code Online (Sandbox Code Playgroud)

当我在Management Studio中运行上述代码时,我的视图将被更改并且注释将被保存.如果我以后再做Script View As --> ALTER TO --> New Query Window,评论将重新出现.

那么Management Studio如何知道这些评论"属于"视图?它与之有关SET QUOTED_IDENTIFIER ON吗?

t-sql sql-server comments ssms sql-server-2005

6
推荐指数
1
解决办法
974
查看次数

通过TFS Build 2008签署ClickOnce清单?

我在解决如何从TFS Build中"签署我的应用程序的ClickOnce清单"时遇到了问题.

我已经在VS 2010中配置了我的签名页面,选中"签署ClickOnce清单"复选框并从文件中选择我们的代码签名密钥,如下面的屏幕截图所示:

在VS 2010中签名页面

现在,当我从VS 2010发布应用程序时,清单似乎已成功签名:

安全警告显示良好的证书

但是,当我尝试从TFS Build构建应用程序时,它似乎没有尝试签署清单.事实上,甚至没有错误消息表明某些事情失败了.

我试图设置TFSBuild.proj文件,以便我的构建服务器知道证书并且我希望签署我的清单,但我不知道该怎么做.

我尝试过以下方法:

<CustomPropertiesForBuild>SignManifests=true;ManifestCertificateThumbprint=<thumbprint goes here></CustomPropertiesForBuild>
Run Code Online (Sandbox Code Playgroud)

但它似乎没有任何区别.(也不会产生错误).

注意:我对强化命名我的程序集感兴趣; 只需签署我的代码.

有谁知道如何做到这一点?有没有人从TFS Build成功部署ClickOnce应用程序?

tfs2008 code-signing visual-studio-2010 tfsbuild

6
推荐指数
1
解决办法
2385
查看次数