小编bro*_*oke的帖子

计算文件的MD5校验和

我正在使用iTextSharp从PDF文件中读取文本.但是,有时我无法提取文本,因为PDF文件只包含图像.我每天都下载相同的PDF文件,我想查看PDF是否已被修改.如果无法获得文本和修改日期,MD5校验和是否是判断文件是否已更改的最可靠方法?

如果是的话,一些代码样本会受到赞赏,因为我对密码学没有多少经验.

.net c# hash md5

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

C#应用程序是否跟踪其运行时间?

如果确实如此,是否有一种简单的方法可以获得自开始以来的总时间?

.net c#

102
推荐指数
3
解决办法
4072
查看次数

Web客户端例外:基础连接已关闭:无法为SSL/TLS安全通道建立信任关系

我有一个简单的应用程序,它使用C#Web Client类下载网站HTML.这是我正在使用的代码的精简样本:

WebClient wc = new WebClient();
wc.Headers.Add("user-agent",
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
htmlCode = wc.DownloadString("https://www.oig.hhs.gov/exclusions/exclusions_list.asp");
Run Code Online (Sandbox Code Playgroud)

网站证书似乎存在问题,因为我遇到了这个例外:

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." "The remote certificate is invalid according to the validation procedure.

如果您将链接复制并粘贴到浏览器中,则需要您在允许您查看网站之前同意风险.它是一个政府网站,所以我不担心任何病毒或任何东西.有没有告诉网络客户端绕过这个问题,并继续访问该网站?

.net c# ssl

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

"指定的'@notify_email_operator_name'无效"错误

我有一个脚本的SQL Server代理作业我试图从服务器转移到我的本地数据库,但我收到此错误消息:

消息14234,级别16,状态1,过程sp_verify_job,行243指定的"@notify_email_operator_name"无效(sp_help_operator返回有效值).

双击错误消息甚至不会将我带到失败的行.有没有人以前得到过这个?

sql-server sql-server-agent sql-server-2008

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

iTextSharp异常:找不到PDF标头签名

我正在iTextSharp阅读PDF文档的内容:

  PdfReader reader = new PdfReader(pdfPath);

                using (StringWriter output = new StringWriter())
                {
                    for (int i = 1; i <= reader.NumberOfPages; i++)
                        output.WriteLine(PdfTextExtractor.GetTextFromPage(reader, i, new SimpleTextExtractionStrategy()));

                    reader.Close();
                    pdfText = output.ToString();
                }
Run Code Online (Sandbox Code Playgroud)

99%的时间它运作得很好.但是,有一个PDF文件有时会抛出此异常:

找不到PDF标题签名.StackTrace:在iTextSharp.text.pdf.PRTokeniser.CheckPdfHeader()位于iTextSharp.text.pdf.PdfReader.ReadPdf(),位于Reader.PDF的iTextSharp.text.pdf.PdfReader..ctor(String filename,Byte [] ownerPassword) .DownloadPdf(String url)在C:\ Documents\Visual Studio中

令人讨厌的是我不能总是重现错误.有时候它有效,有时则不然.有谁遇到过这个问题?

.net c# pdf itext

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

TextBoxFor值在帖子后没有更新

我有一个简单的强类型视图,但我似乎无法在帖子后更新我的表单上的文本框.

这是我的模型:

public class Repair
  {
    public string Number { get; set; }      
  }
Run Code Online (Sandbox Code Playgroud)

在我看来是一个TextBox:

   @Html.TextBoxFor(x => x.Number)
Run Code Online (Sandbox Code Playgroud)

我试图在发布到我的控制器后更新文本框:

 [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Index(Repair r)
        {

          r.Number = "New Value";

          return View(r);

        }
Run Code Online (Sandbox Code Playgroud)

即使我将Number设置为新值,文本框中的文本也不会更改.我究竟做错了什么?

c# asp.net-mvc asp.net-mvc-4

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

SQL查询如何有两个from子句?

这对我来说太奇怪了:

delete from GearsDev.dbo.Products 
from GearsDev.dbo.Products as C
inner join #Common as M
    on M.item = C.ItemNumber
Run Code Online (Sandbox Code Playgroud)

#Common 是一个临时表,但其余部分对我没有意义.

你怎么能有两个from条款?

sql t-sql sql-server sql-server-2008

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

在MVC4中捆绑的正确方法

我对捆绑脚本和样式文件的正确方法感到困惑.目前,我的BundleConfig.cs看起来像这样:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            "~/Scripts/jquery-ui-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery.unobtrusive*",
            "~/Scripts/jquery.validate*"));

// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
            "~/Scripts/modernizr-*"));

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
            "~/Scripts/knockout-{version}.js",
            "~/Scripts/knockout-{version}.debug.js",
            "~/Scripts/knockout-sortable.js"));

bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
            "~/Content/themes/base/jquery.ui.core.css",
            "~/Content/themes/base/jquery.ui.resizable.css",
            "~/Content/themes/base/jquery.ui.selectable.css",
            "~/Content/themes/base/jquery.ui.accordion.css",
            "~/Content/themes/base/jquery.ui.autocomplete.css",
            "~/Content/themes/base/jquery.ui.button.css",
            "~/Content/themes/base/jquery.ui.dialog.css",
            "~/Content/themes/base/jquery.ui.slider.css",
            "~/Content/themes/base/jquery.ui.tabs.css",
            "~/Content/themes/base/jquery.ui.datepicker.css",
            "~/Content/themes/base/jquery.ui.progressbar.css",
            "~/Content/themes/base/jquery.ui.theme.css"));

bundles.Add(new StyleBundle("~/bundles/BootStrapcss").Include(
            "~/BootStrap/css/bootstrap.css",
            "~/BootStrap/css/bootstrap-fileupload.css"));

bundles.Add(new StyleBundle("~/bundles/BootStrap").Include(
            "~/BootStrap/tpg-main.css",
            "~/BootStrap/tpg-internal.css"));

bundles.Add(new ScriptBundle("~/bundles/BootStrapjs").Include(
            "~/BootStrap/js/bootstrap-fileupload.js",
            "~/BootStrap/js/bootstrap.js")); …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-4

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

如何在不使用表的情况下在CSS中执行此操作?

在此输入图像描述

通常情况下,使用表格会非常容易,但是现在每个人都说桌子很糟糕.我的大多数网络表单都是这样的:

[标签] [文本框]

[标签] [文本框]

[label] [combobox] [textbox]

我只是希望一切都整齐排列.

*编辑:为了澄清,我没有使用表格来布局我的网页表格.这是使用CSS完成的.但是,从一些评论来看,似乎表格可以排列我的控件.我认为这可能是最好的解决方案......

html css asp.net

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

使用 jquery 选择 &lt;select&gt; 列表中的最后一项

我的表单上有一个<select>元素,其 multiple 属性设置为“true”。填充元素后,如何使用 jquery 选择列表中的最后一项?我希望以与单击鼠标选择项目相同的方式选择该项目:

在此输入图像描述

html jquery

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