小编Mar*_*n B的帖子

IIS URL重写模块:基于QueryString的重定向

我在根据查询字符串参数重定向到另一个URL时遇到一些问题.我想将输入www.domain.com/signup.aspx?p=1的用户重定向到:

www.domain.com/signup

<rule name="Signup Redirect 1" stopProcessing="true">
  <match url="signup\.aspx\?p=1" />
  <conditions logicalGrouping="MatchAll" />
  <action type="Redirect" url="signup" redirectType="Temporary" />
</rule>
Run Code Online (Sandbox Code Playgroud)

现在,当他们进入www.domain.com/signup.aspx?p=2时,他们必须去:

www.domain.com/signup/promocode

<rule name="Signup Redirect 2" stopProcessing="true">
  <match url="signup\.aspx\?p=2" />
  <conditions logicalGrouping="MatchAll" />
  <action type="Redirect" url="signup/promocode" redirectType="Temporary" />
</rule>
Run Code Online (Sandbox Code Playgroud)

以上规则不起作用.这样做的正确方法是什么?提前致谢.

GR

马亭

iis iis-7 url-rewriting url-rewrite-module

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

如何捆绑ASP.NET MVC区域的资源?

你会如何为asp.net mvc区域进行资源捆绑?这是否受ASP.NET MVC框架的限制,就像AreaRegistrationfor routes一样?

我可以做一个BundleConfig类区域内,并从全球称之为BundleConfig内部App_Start文件夹,但这种感觉好好尝试一下对我好.

我找不到有关此主题的任何信息.任何帮助我们的意见表示赞赏.

asp.net-mvc bundle asp.net-mvc-4 asp.net-optimization

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

为什么立即调用此分组运算符+函数

我正在研究Immediatly Invoked Function Expressions(IIFE)的行为,在这样做时我遇到了以下情况.

(function () {
    document.write("bar");
})

(function () {
    document.write("foo");
}());
Run Code Online (Sandbox Code Playgroud)

我认为第一个只是一个分组运算符,里面有一个函数表达式而不调用它.第二个是分组运算符以及函数表达式,但现在调用该函数.

我觉得奇怪的是两者都被调用了,为什么呢?

(function () {
    document.write("bar");
})

var x = 1;

(function () {
    document.write("foo");
}());
Run Code Online (Sandbox Code Playgroud)

当我通过在两者之间插入变量声明来打破这两个时,它只是写foo.这是我的预期.

javascript iife

9
推荐指数
1
解决办法
1437
查看次数

DllImport属性是否始终加载非托管DLL

这个问题激励我提出以下问题.即使您没有调用/使用该方法,DllImport属性是否始终加载特定的DLL.

例如,当您有以下代码时:

static class Program {

    [DllImport("kernel32.dll")]
    static extern bool AllocConsole();

    static void Main()
    {
        if (true)                                
        {
            //do some things, for example starting the service.
        }
        else 
        {
            AllocConsole();
        }           
     }        
 }
Run Code Online (Sandbox Code Playgroud)

现在,当应用程序启动时,AllocConsole永远不会被激活但是dll会被加载吗?

.net c#

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

ELMAH在主题页面错误

我有一个主题页面,主题在http模块中选择.

public void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
    Page p = HttpContext.Current.Handler as Page;

    if (p != null)
    {
        //get theme
        string theme = GetTheme(HttpContext.Current.Request.Url.Host);

        Debug.WriteLine(String.Format("Loading theme {0}", theme));

        //set theme of page
        p.Theme = theme;
    }
}
Run Code Online (Sandbox Code Playgroud)

private const string ELMAH_ERROR_PAGE = "Elmah.ErrorLogPage";

        if (p.GetType().FullName != ELMAH_ERROR_PAGE)
        {
            p.Theme = theme;
        }
Run Code Online (Sandbox Code Playgroud)

public void context_PreRequestHandlerExecute(object sender, EventArgs e)
{
    Page p = HttpContext.Current.Handler as Page;

    if (p != null)
    {
        //get theme
        string theme = GetTheme(HttpContext.Current.Request.Url.Host);

        Debug.WriteLine(String.Format("Loading theme {0}", …
Run Code Online (Sandbox Code Playgroud)

c# asp.net elmah exception-handling

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

有没有办法检查某个断言是否失败

我有一个带有响应和持续时间断言的HTTP请求采样器.现在,当响应断言失败时,不允许下一个HTTP请求采样器运行.仅当持续时间断言失败时,才允许下一个HTTP请求采样器运行.

我开始这样做IF Controller并检查${JMeterThread.last_sample_ok}但是,当我只有响应声明到位时.添加持续时间断言和新要求时,不再应用此要求.

我已经尝试过BeanShell Post Processors在持续时间断言失败时添加某些变量.但是当持续时间断言失败时,以下代码总是给我回来和空数组事件.

BeanShell后处理器代码:

import org.apache.jmeter.assertions.AssertionResult;

AssertionResult[] results = prev.getAssertionResults();

if (results.length == 0) {
   vars.put("assertions_have_zero_length", "true"); 
}

//debug post processor shows the above variable.
Run Code Online (Sandbox Code Playgroud)

我也尝试使用BeanShell监听器,这确实给了我两个断言,但是在创建(放置)某些变量时,它们没有显示在调试后处理器中.

BeanShell侦听器代码:

import org.apache.jmeter.assertions.AssertionResult;

AssertionResult[] results = sampleResult.getAssertionResults();

System.out.println("Current counter value = " + results.length);

if (results.length == 0) {
  vars.put("assertions_have_zero_length", "true"); 
} else {
  vars.put("assertions_have_zero_length", "false"); 
}

//no assertion_have_zero_length variable shown in debug post processor.
Run Code Online (Sandbox Code Playgroud)

我做错了什么,甚至可能是我想要的吗?

提前致谢.

jmeter

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

如何使用JMeter设置负载测试,以使用SAML执行SP发起的SSO

我想使用JMeter设置负载测试,以便使用SAMLv2与各种用户执行SP发起的SSO.这包括将所需AuthNRequest消息发布到身份提供商(IDP)的登录URL,还包括当前用户的凭据(用户名,密码).

AuthNRequest必须签名和加密,所以我想离开这个给服务提供商(SP),抢,不知怎的,这样我就可以重新使用(但我不知道是否我需要做的是,在第一个地方-也许后续重定向足够了).

我发现很难理解要完成这些步骤.我不需要关于在JMeter中单击的位置的准确指导,而是需要更多关于所涉及的HTTP请求采样器(包括顺序),前后处理器和断言的概述.

我们有服务提供商支持SAML HTTP-POSTSAML HTTP-Redirect绑定以将其传输AuthNRequest到IDP.

任何帮助都会很棒!提前致谢.

jmeter load-testing saml openam

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

为什么我的堆上有两个空的ThreadAbortExceptions?

我正在调查WinDBG的内存转储,我想知道为什么堆中有两个System.Threading.ThreadAbortExceptions都是空的.

对于其他三个发现的异常,我理解它们为什么存在并且它们是默认创建的:

  1. System.ExecutionEngineException

  2. System.StackOverflowException

  3. System.OutOfMemoryException

WinDBG输出

0:000>!dumpheap -type System.Threading.ThreadAbortException

Address       MT     Size
010210fc 79330ef8       72     
01021144 79330ef8       72     
total 2 objects

Statistics:
MT    Count    TotalSize Class Name
79330ef8        2          144 System.Threading.ThreadAbortException

Total 2 objects
Run Code Online (Sandbox Code Playgroud)

0:000>!pe 010210fc

Exception object: 010210fc
Exception type: System.Threading.ThreadAbortException
Message: <none>
InnerException: <none>
StackTrace (generated):<none>
StackTraceString: <none>
HResult: 80131530
Run Code Online (Sandbox Code Playgroud)

0:000>!pe 01021144

Exception object: 01021144
Exception type: System.Threading.ThreadAbortException
Message: <none>
InnerException: <none>
StackTrace (generated): <none>
StackTraceString: <none>
HResult: 80131530
Run Code Online (Sandbox Code Playgroud)

所以我的问题是:

  1. 这两个也是默认创建的 - 如果是这样 - 为什么还有两个?
  2. 如果没有,为什么他们是空的? …

c# clr windows-services windbg

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