小编Ste*_*ack的帖子

EWS:如何更新EmailMessage的IsRead属性

如何更新使用EWS或其他方法的IsRead属性EmailMessage

只是设置mail.IsRead=true似乎没有持续.

c# asp.net exchangewebservices

8
推荐指数
1
解决办法
3940
查看次数

asp.net:如何在后端找到转发器div?

我使用repeater来显示从数据库中获取的记录,特别是我使用div标签来显示存储在datatable中的html内容.但我不知道如何在后端找到div.在Repeater_ItemDataBound事件中,我可以使用

Control divControl=e.Item.FindControl("divControl"); 
Run Code Online (Sandbox Code Playgroud)

得到它但它没有innerHtml属性来设置html内容.有谁知道如何将其作为div控件?

asp.net repeater

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

如何在c#中获取网站根路径?

在c#代码中,我需要为图像编写src.有谁知道如何在c#中获取网站根路径?我的文件夹结构是UI/Image我发现当我使用时

string rootpath=Page.Request.ApplicationPath;
Run Code Online (Sandbox Code Playgroud)

如果在调试模型中运行应用程序,它可以工作.但如果通过直接输入url来运行它,它将不会显示图像.图像的属性是http://image/turnon.bmp,它应该是http://localhost/image/turnon.bmp

任何的想法?

c#

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

如何忽略SSL证书是由未知的证书颁发机构签署的问题?

我正在开发c#应用程序来调用Exchange Management Shell Cmdlet.它总是出现"目标计算机上的服务器证书(208.243.XX.2XX:443)具有以下错误:
SSL证书由未知证书颁发机构签名
.SSL证书包含一个通用名称(CN )与主机名不匹配."

但是我确实编写了接受所有证书的代码,不知道为什么还会得到错误.

我的代码:

    PSCredential credential = new PSCredential("administrator", securePwd);

    WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("https://208.243.49.20/powershell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credential);
    connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic;

    Runspace runspace = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace(connectionInfo);
    PowerShell powershell = PowerShell.Create();
    PSCommand command = new PSCommand();
    command.AddCommand("New-Mailbox");
    command.AddParameter("Name", "TestName");
    powershell.Commands = command;
    ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(
    delegate { return true; }
);
    try
    {
        runspace.Open();//This is where the exception happens
        powershell.Runspace = runspace;
        Collection<PSObject> result= powershell.Invoke();
    }
Run Code Online (Sandbox Code Playgroud)

c# asp.net powershell ssl

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

使用C#运行PowerShell脚本

PowerShell powershell = PowerShell.Create();
PSCommand command = new PSCommand();
command.AddScript("[System.Net.ServicePointManager]::ServerCertificateValidationCallback+={$true}");
Run Code Online (Sandbox Code Playgroud)

是对的吗?
下一步是什么?

c# powershell

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

如何从 CKEditor 获取 html?

我在我的网络应用程序中使用 CKEditor,但我不知道如何从中获取 html 内容。 http://cksource.com/ckeditor 我在网上搜索发现一个说使用 getData() 方法,但没有 getData () 方法在控制器后键入点。谁能给我一个示例代码来从 CKEditor 控制器获取 html?先感谢您。

javascript ckeditor

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

如何获取收件箱文件夹实例?

如果我想知道收件箱中有多少项,我使用TotalCount属性,但如何首先获取收件箱文件夹?如果我使用FindFoldersResults findFolders = service.FindFolders()方法,收件箱的父文件夹名称是什么?谢谢.

c# asp.net exchangewebservices

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

如何在viewstate中存储对象?

我正在使用EWS开发我的电子邮件客户端.我发现如果我将ItemId存储在viewstate中会导致异常,说:

在程序集"Microsoft.Exchange.WebServices,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"中键入"Microsoft.Exchange.WebServices.Data.ItemId"未标记为可序列化.

如果我ItemId像字符串一样存储:

ViewState["itemId"] = id.ToString();
Run Code Online (Sandbox Code Playgroud)

然后试着回头

ItemId id = (ItemId)ViewState["itemId"];
Run Code Online (Sandbox Code Playgroud)

它说我无法从字符串转换为ItemId.任何的想法?

c# asp.net viewstate

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

如何从查询中获取前1条记录

假设查询中有5条记录,如何获得前1条记录?这是我目前的代码.

public Application GetByUserIdAndVersion(int userId, string version)
{
    VettingDataContext dc = new VettingDataContext(_connString);
    return (from a in dc.Applications
            where a.UserId == userId && a.chr_Version == version
            select a).SingleOrDefault<Application>();
}
Run Code Online (Sandbox Code Playgroud)

linq

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

如何使用C#列出文件夹中的所有图像?

我需要使用C#列出文件夹中的所有图像.

我搜索了Stack Overflow并找到了一些讨论它的线程,但问题是覆盖PHP.我需要用C#做这件事.

c#

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