Tag: .net

如何在控制台应用程序中使用Razor View Engine?

我的控制台应用需要发送HTML电子邮件。 我想在Razor视图中以HTML格式编写电子邮件,并让引擎生成电子邮件正文内容。 这意味着没有控制器或请求。 我怎么能这样做?

如何检查邮件是否已成功发送

我正在开发一个Asp.Net应用程序,如果他忘记了密码,我将向用户的电子邮件地址发送邮件。 我想检查邮件是否已成功发送。 有没有什么方法可以肯定地知道。 编辑 如果电子邮件ID不存在,那么我会检测到失败。

如何在PHPunit testing中获得与C#相同的HMAC256结果?

我以为我会尝试将新的签名请求逻辑添加到我的Facebookcanvas应用程序中,以使我自己“轻松”我在GitHub上访问facebook PHP sdk并查看unit testing 。 我的实际问题是我无法获得请求中包含的哈希值,以匹配我使用应用程序机密计算的哈希值以及请求中发送的数据。 在Facebook的身份validation页面上描述了这是如何工作的 。 private string VALID_SIGNED_REQUEST = “ZcZocIFknCpcTLhwsRwwH5nL6oq7OmKWJx41xRTi59E.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOiIxMjczMzU5NjAwIiwib2F1dGhfdG9rZW4iOiIyNTQ3NTIwNzMxNTJ8Mi5JX2VURmtjVEtTelg1bm8zakk0cjFRX18uMzYwMC4xMjczMzU5NjAwLTE2Nzc4NDYzODV8dUk3R3dybUJVZWQ4c2VaWjA1SmJkekdGVXBrLiIsInNlc3Npb25fa2V5IjoiMi5JX2VURmtjVEtTelg1bm8zakk0cjFRX18uMzYwMC4xMjczMzU5NjAwLTE2Nzc4NDYzODUiLCJ1c2VyX2lkIjoiMTY3Nzg0NjM4NSJ9”; private string NON_TOSSED_SIGNED_REQUEST = “laEjO-az9kzgFOUldy1G7EyaP6tMQEsbFIDrB1RUamE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiJ9”; public void SignedRequestExample() { var Encoding = new UTF8Encoding(); string ApplicationSecret = “904270b68a2cc3d54485323652da4d14”; string SignedRequest = VALID_SIGNED_REQUEST; string ExpectedSignature = SignedRequest.Substring(0, SignedRequest.IndexOf(‘.’)); string Payload = SignedRequest.Substring(SignedRequest.IndexOf(‘.’) + 1); // Back & Forth with Signature byte[] ActualSignature = […]

使用SSL创建TCP客户端连接

我正在尝试创建TCP连接并发送/读取使用SSL的数据,但我无法成功完成此操作。 我想做的是这样的: TcpClient _tcpClient = new TcpClient(“host”, 110); BinaryReader reader = new BinaryReader(new System.Net.Security.SslStream(_tcpClient.GetStream(), true)); Console.WriteLine(reader.ReadString()); 我虽然没有运气。 创建BinaryReader时抛出exception。 有谁知道这样做的一个简单例子? 我不想写这个服务器端,只是客户端。

什么是C#中的通用集合?

我正在尝试构建我的第一个通用列表并遇到了一些问题。 我理解声明看起来像“ List ”,我using System.Collections.Generic; 在我的页面顶部。 但是,Visual Studio无法识别T变量。 我错过了什么?

来自asp.net 2.0的REST

我刚刚建立了一个asp.net 2.0网站。 现在我需要添加REST Web服务,以便我可以与另一个Web应用程序进行通信。 我以前使用过2个SOAP Web服务项目,但根本没有使用REST的经验。 我想只有几周才能正常工作。 谷歌搜索后,我发现它并不那么容易。 这是我发现的: 没有REST开箱即用的asp.net。 WCF REST入门套件Codeplex预览版2基于.net 3.5并仍处于测试阶段 restASP.NET示例 ASP.NET 2.0中的REST Web服务(C#) Exyus 使用摇篮曲处理POST和PUT方法 ADO.NET数据服务 … 现在我的问题, a).net 2.0的REST解决方案? 如果是,哪一个是最佳解决方案? b)如果必须,我的asp.net从2.0迁移到3.5有多难? 它只是编译简单,或者我必须更改很多代码? c)WCF REST入门套件是否足以在生产中使用? d)我是否必须首先学习WCF,然后是WCF REST入门套件? 哪里是最好的起点? 我感谢任何帮助。 谢谢Wes

在WinRT应用程序中处理向上滑动,向下滑动,向左滑动和向右滑动手势

我有以下代码: public MainPage() { this.InitializeComponent(); this.ManipulationStarting += MainPage_ManipulationStarting; this.ManipulationStarted += MainPage_ManipulationStarted; this.ManipulationInertiaStarting += MainPage_ManipulationInertiaStarting; this.ManipulationDelta += MainPage_ManipulationDelta; this.ManipulationCompleted += MainPage_ManipulationCompleted; } void MainPage_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e) { Debug.WriteLine(“MainPage_ManipulationStarting”); } void MainPage_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) { Debug.WriteLine(“MainPage_ManipulationStarted”); } void MainPage_ManipulationInertiaStarting(object sender, ManipulationInertiaStartingRoutedEventArgs e) { Debug.WriteLine(“MainPage_ManipulationInertiaStarting”); } void MainPage_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) { Debug.WriteLine(“MainPage_ManipulationDelta”); } void MainPage_ManipulationCompleted(object […]

使用StackExchange.Redis的Redis键空间通知

我环顾四周,我无法找到如何使用StackExchange.Redis库在Redis上执行键空间通知订阅。 检查可用的测试我发现使用频道的pubsub,但这更像是服务总线/排队,而不是订阅特定的Redis键事件。 是否可以使用StackExchange.Redis利用此Redisfunction?

使用ASP.NET Web API,控制器如何返回使用DotNetZip Library压缩的流图像集合?

如何创建Web API控制器,生成并返回从内存中JPEG文件(MemoryStream对象)集合流式传输的压缩zip文件。 我正在尝试使用DotNetZip库。 我找到了这个例子: http : //www.4guysfromrolla.com/articles/092910-1.aspx#postadlink 。 但是,Response.OutputStream在Web API中不可用,因此该技术不能正常工作。 因此我尝试将zip文件保存到新的MemoryStream中; 但它扔了。 最后,我尝试使用PushStreamContent。 这是我的代码: public HttpResponseMessage Get(string imageIDsList) { var imageIDs = imageIDsList.Split(‘,’).Select(_ => int.Parse(_)); var any = _dataContext.DeepZoomImages.Select(_ => _.ImageID).Where(_ => imageIDs.Contains(_)).Any(); if (!any) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } var dzImages = _dataContext.DeepZoomImages.Where(_ => imageIDs.Contains(_.ImageID)); using (var zipFile = new ZipFile()) { foreach […]

我应该为ASP .NET MVC应用程序使用内置成员资格提供程序吗?

到目前为止,我一直在使用自定义成员资格提供程序进行身份validation。 我即将开始使用MVC开发我的第一个网站。 我想知道我是否应该使用ASP .NET MVC附带的内置成员资格提供程序,或者我是否应该创建自己的。 我的网站需要与openid,facebook,google等集成进行身份validation和api访问的openauth。 我想知道根据我的需要使用内置的那么容易。