小编Mor*_*gil的帖子

当鼠标移过表格中的一行时,将光标更改为手形

如何改变光标指针的手时,我的鼠标越过一个<tr><table>

<table class="sortable" border-style:>
  <tr>
    <th class="tname">Name</th><th class="tage">Age</th>
  </tr>
  <tr><td class="tname">Jennifer</td><td class="tage">24</td></tr>
  <tr><td class="tname">Kate</td><td class="tage">36</td></tr>
  <tr><td class="tname">David</td><td class="tage">25</td></tr>
  <tr><td class="tname">Mark</td><td class="tage">40</td></tr>
</table>
Run Code Online (Sandbox Code Playgroud)

html css cursor

189
推荐指数
9
解决办法
40万
查看次数

为什么我在使用HttpWebRequest时在某些链接上出现"(304)Not Modified"错误?

我尝试使用HttpWebRequest访问某些链接的任何想法我得到"远程服务器返回错误:(304)未修改." 在代码中?

我正在使用的代码来自Jeff的帖子(该页面似乎已经消失,请在Wayback Machine上查看归档副本).

注意代码的概念是一个简单的代理服务器,因此我将浏览器指向这个本地运行的代码片段,它获取我的浏览器请求,然后通过创建新的HttpWebRequest代理它,如您所见代码.它适用于大多数网站/链接,但对于一些人来说,这个错误出现了.您将在代码中看到一个关键位,它似乎将http标头设置从浏览器请求复制到它的请求到网站,并在标头属性中复制.不确定问题是否与它如何模仿请求的这个方面有关,然后结果会发生什么?

case "If-Modified-Since":
   request.IfModifiedSince = DateTime.Parse(listenerContext.Request.Headers[key]);
   break;
Run Code Online (Sandbox Code Playgroud)

我从例如http://en.wikipedia.org/wiki/Main_Page获得了该问题

PS.更新在这里

仍然无法解决这个问题.基本上我可以识别1个有问题的链接,它似乎工作正常,第二次得到错误,第3次OK,第4次得到错误,第5次OK等等好像有一些状态没有被清除或代码中有些东西.我尝试使用"使用"类型语句等来清理代码.

这是代码.如果有人能够发现为什么我每次第二次浏览http://newsimg.bbc.co.uk/css/screen/1_0_16/nol/v4/story.css这样的链接(从第2次开始,而不是第一次)通过这个代理代码,我得到了我想听到的错误.

class Program
{
    static void Main(string[] args)
    {
        Proxy p = new Proxy(8080);

        Thread proxythread = new Thread(new ThreadStart(p.Start));
        proxythread.Start();

        Console.WriteLine("Proxy Started. Press Any Key To Stop...");
        Console.ReadKey();

        p.Stop();
     }
}

public class Proxy
{
    private HttpListener _listener;
    private int _port;

    public Proxy(int port)
    {
        int defaultport = 8080;

        // Setup Thread Pool
        System.Threading.ThreadPool.SetMaxThreads(50, 1000); …
Run Code Online (Sandbox Code Playgroud)

http httpwebrequest if-modified-since http-status-code-304

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

如何从PEM文件中获取私钥?

我有一个.PEM文件,其中包含用于SSL数据传输的公钥和私钥,如下所示:

-----BEGIN RSA PRIVATE KEY-----
      private key data
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
      public key data
-----END CERTIFICATE-----
Run Code Online (Sandbox Code Playgroud)

当我想通过以下代码加载.PEM文件时:

X509Certificate2 xx = new X509Certificate2("c:\\myKey.pem");
Run Code Online (Sandbox Code Playgroud)

我得到一个例外,说:"找不到请求的对象." ,满堆栈:

System.Security.Cryptography.CryptographicException was unhandled
  Message=Cannot find the requested object.

  Source=mscorlib
  StackTrace:
       at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
       at System.Security.Cryptography.X509Certificates.X509Utils._QueryCertFileType(String fileName)
       at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromFile(String fileName, Object password, X509KeyStorageFlags keyStorageFlags)
       at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName)
       at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName)
       at DLLTest.SSL_Test.test() in E:\Projects\DLLTest\DLLTest\SSL_Test.cs:line 165
       at DLLTest.SSL_Test.Run() in E:\Projects\DLLTest\DLLTest\SSL_Test.cs:line 21
       at DLLTest.Program.Main(String[] args) in E:\Projects\DLLTest\DLLTest\Program.cs:line 21
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, …
Run Code Online (Sandbox Code Playgroud)

.net ssl cryptography pem private-key

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

在webform中查找控件

我有一个Web内容表单,需要访问内容面板中的控件.我知道有两种访问控件的方法:

  1. TextBox txt = (TextBox)Page.Controls[0].Controls[3].Controls[48].Controls[6]
  2. 通过编写一个搜索所有控件的递归函数.

还有其他更简单的方法,因为Page.FindControl在这种情况下不起作用.我问的原因是我感觉像Page对象或Content Panel对象应该有一个方法来查找子控件,但找不到类似的东西.

c# asp.net webforms

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

msbuild"无法删除目录"

我们的一个CruiseControl.NET项目间歇性地失败,因为msbuild任务失败了

错误MSB3231:无法删除目录"d:\ Somewhere\Dir\Admin".参数不正确.

相应的msbuild脚本行就是

<RemoveDir Directories="$(DistributionDir)\Admin" Condition="Exists('$(DistributionDir)\Admin')" />
Run Code Online (Sandbox Code Playgroud)

当我在构建失败后查看状态时,目录内容已成功删除,但空目录本身就在那里.并且下一个构建通常会成功(必须只删除空目录).请注意,问题似乎不是通常的"其他一些进程(如防病毒)保持锁定目录",错误不是"访问被拒绝",而是一个非常奇怪的"参数不正确".

我使用SysInternals Process Monitor监视构建,结果很奇怪 - 一切都按预期进行,目录的内容被枚举,删除,当顶级目录枚举完成"NO MORE FILES"时,目录关闭, 没别的了.没有其他操作进入进程监视器:

10:04:09,9190557    MSBuild.exe 3516    QueryDirectory  D:\Somewhere\Dir\Admin  NO MORE FILES   
10:04:09,9190928    MSBuild.exe 3516    CloseFile       D:\Somewhere\Dir\Admin  SUCCESS 
Run Code Online (Sandbox Code Playgroud)

下一个(成功的)构建尝试只是一个无聊的成功目录删除:

10:31:21,8616463    MSBuild.exe 1760    CreateFile  D:\Somewhere\Dir\Admin  SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
10:31:21,8616861    MSBuild.exe 1760    QueryDirectory  D:\Somewhere\Dir\Admin\*    SUCCESS Filter: *, 1: .
10:31:21,8617305    MSBuild.exe 1760    QueryDirectory  D:\Somewhere\Dir\Admin  SUCCESS 0: ..
10:31:21,8617589 …
Run Code Online (Sandbox Code Playgroud)

cruisecontrol.net msbuild

11
推荐指数
3
解决办法
9193
查看次数

C#System.Security.Cryptography.HMACSHA1.ComputeHash()不返回预期结果

我正在尝试基于RFC 4226在C#中实现OTP解决方案:http://tools.ietf.org/html/rfc4226

我找到了一个示例实现,它看起来像这样:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace OTP
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
            byte[] secretKey = encoding.GetBytes("12345678901234567890");
            byte[] counter = encoding.GetBytes("1");
            Console.WriteLine(CalculateHotp(secretKey, counter));
            Console.ReadKey();
        }

        public static int CalculateHotp(byte[] key, byte[] counter)
        {
            var hmacsha1 = new HMACSHA1(key);
            byte[] hmac_result = hmacsha1.ComputeHash(counter);
            int offset = hmac_result[19] & 0x0f;
            int bin_code = (hmac_result[offset] & 0x7f) << 24
                           | (hmac_result[offset + 1] & …
Run Code Online (Sandbox Code Playgroud)

.net c# cryptography

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

实现自定义Windows身份验证包

我正在为Windows 7的MSV1_0构建一个自定义身份验证子包.我已经使用了Windows SDK中的msvsubauth示例,我对我遇到的一些问题有两个问题:

  1. 当我正在尝试确保调用例程get并将注册表中的Auth0属性设置为我的包并在创建文件的Msv1_0SubAuthenticationRoutine末尾添加一个简单代码:

    //
    // Cleanup up before returning.
    //
    
    
    Cleanup:
    hTestFile = CreateFile(
                  TEXT("C:\\lsa\\lsa.txt"), 
                  GENERIC_READ|GENERIC_WRITE, 0, 
                  NULL, CREATE_ALWAYS, 
                  FILE_ATTRIBUTE_NORMAL, NULL);
    
    
    if(hTestFile != INVALID_HANDLE_VALUE) {
          CloseHandle(hTestFile);
    }
    
    
    return Status;
    
    
    }  // Msv1_0SubAuthenticationRoutine
    
    Run Code Online (Sandbox Code Playgroud)

    显然,包被调用,因为当我输入我的密码时,我收到来自windows的错误消息"参数不正确"这是一个好兆头.但为什么我会收到这个错误?当从单独的.exe文件执行完全相同的代码时,它运行完美并创建测试文本文件.我检查了权限并为"所有人"设置了"完全控制".有任何想法吗?SDK没有明确提到LSA为auth包中的代码创建了什么样的隔离.

  2. 第二个问题是测试AP.目前,每次更改我都会重建库,将其复制到测试VM,然后复制到System32文件夹并重新启动它.有更简单的方法吗?

预先感谢!

c++ windows winapi local-security-authority

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

如何正确调用LsaLogonUser进行交互式登录?

我正在尝试使用LsaLogonUser创建交互式登录会话,但它始终返回STATUS_INVALID_INFO_CLASS(0xc0000003).从我在网上搜索中发现,KERB_INTERACTIVE_LOGON结构的内存布局很棘手,但我很确定我已经做到了.

我也尝试使用MSV1.0而不是Kerberos,MSV1_0_INTERACTIVE_LOGON用于身份验证结构和MSV1_0_PACKAGE_NAME包名称,但是失败了STATUS_BAD_VALIDATION_CLASS(0xc00000a7).

谁能告诉我这里做错了什么?这是代码,大部分错误处理都被剥离了.显然,这不是生产质量; 我只想尝试一个工作样本.


// see below for definitions of these
size_t wcsByteLen( const wchar_t* str );
void InitUnicodeString( UNICODE_STRING& str, const wchar_t* value, BYTE* buffer, size_t& offset );

int main( int argc, char * argv[] )
{
    // connect to the LSA
    HANDLE lsa;
    LsaConnectUntrusted( &lsa );

    const wchar_t* domain = L"mydomain";
    const wchar_t* user = L"someuser";
    const wchar_t* password = L"scaryplaintextpassword";

    // prepare the authentication info
    ULONG authInfoSize …
Run Code Online (Sandbox Code Playgroud)

windows windows-security local-security-authority

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

Windows.event未定义 - Firefox中的JavaScript错误

我正在使用javascript来更改鼠标悬停时asp按钮的某些设置.它在IE中工作.但不适用于Firefox.还有其他任何支持几乎所有浏览器的javascript代码吗?我的代码如下

<script type="text/javascript">
        var previousColor;
        function Changecolor() {
            previousColor = window.event.srcElement.style.backgroundColor;
            window.event.srcElement.style.backgroundColor = "Blue";
            window.event.srcElement.style.cursor = "hand";
        }
        function RestoreColor() {
            window.event.srcElement.style.backgroundColor = previousColor;
        }
</script>


<asp:Button ID="btnSearch" runat="server" BackColor="#800000" Font-Bold="True" Font-Names="Arial" onmouseover="Changecolor();" onmouseout="RestoreColor();" ForeColor="White" Height="28px" OnClick="btnSearch_Click2" Text="Search Jobz" Width="117px" />
Run Code Online (Sandbox Code Playgroud)

javascript asp.net onmouseover

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

Windbg忽略更改寄存器以克服访问冲突

我试图使用WinDbg在我的程序中调试访问冲突.调试器正确捕获访问冲突:

(2604.1e74): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0808e7fb ebx=007b39f8 ecx=000116e7 edx=7ead8618 esi=00000000 edi=00000000
eip=006ed845 esp=0818ff24 ebp=0818ff30 iopl=0         nv up ei pl nz na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010206
image00400000!t_control.is_focused+0x15:
006ed845 8b8051070000    mov     eax,dword ptr [eax+751h] ds:002b:0808ef4c=????????
Run Code Online (Sandbox Code Playgroud)

我想"跳过"访问冲突,以便我可以继续调试(例如,逐步退出故障函数以检查调用者的数据结构).所以我改变eax它指向一个可读的内存,例如当前的代码,所以我这样做:

0:025> r eax=eip
Run Code Online (Sandbox Code Playgroud)

这似乎工作正常,因为以下验证似乎表明:

0:025> r
eax=006ed845 ebx=007b39f8 ecx=000116e7 edx=7ead8618 esi=00000000 edi=00000000
eip=006ed845 esp=0818ff24 ebp=0818ff30 iopl=0         nv up ei …
Run Code Online (Sandbox Code Playgroud)

windbg access-violation

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