-1

I'm trying to implement Response.Redirect within an ASHX file. Initially I was having the issue described here, but now I'm getting

Expression has been evaluated and has no value

on the line with "context.Response.Redirect(redirectPage,false);"

The following is my code (abbreviated).

public void ProcessRequest(HttpContext context)
{
    redirectPage = configuration.Value.SingleLogoutServiceUrl;

    if (redirectPage != string.Empty) {
        context.Response.Redirect(redirectPage,false);
    }
}
Community
  • 1
  • 1
kickinchicken
  • 1,281
  • 4
  • 18
  • 40
  • The message, _Expression has been evaluated and has no value_, is coming from the debugger, which has evaluated the line and since the method is `void`, the expression has no value. – Mark Cidade Jan 14 '15 at 19:54
  • @MarkCidade So therefore this isn't really an error, and is expected behavior? – mason Jan 14 '15 at 19:56
  • Shouldn't the method redirect the HTTP response regardless of the return type? – kickinchicken Jan 14 '15 at 20:02
  • @mason Correct. It isn't an error. You are looking at a debugger message, not an application message. – Mark Cidade Jan 14 '15 at 20:25
  • @MarkCidade There we go. If I were you, I'd turn that into an answer. – mason Jan 14 '15 at 20:25
  • Yes - sorry I was geting this in the debugger. But is there no way to get the page to redirect? Would I have to change the return type? – kickinchicken Jan 14 '15 at 20:41

2 Answers2

0

The message, Expression has been evaluated and has no value, is coming from the debugger, which has evaluated the line and since the method is void, the expression has no value.

It isn't an error. You are looking at a debugger message, not an application message.

Mark Cidade
  • 98,437
  • 31
  • 224
  • 236
  • Thanks but can you tell me how I'd do the redirect off of the handler? It's still not redirecting and I'm not sure what I need to do to make this happen. – kickinchicken Jan 20 '15 at 22:49
  • So long as `redirectPage==null || redirectPage.Length > 0` and nothing is wrong, the code should work. – Mark Cidade Jan 21 '15 at 03:03
0

Actually the issue was that I was redirecting from a localhost environment to a site on the Internet and the site was rejecting the transfer. Thanks everyone for your help.

kickinchicken
  • 1,281
  • 4
  • 18
  • 40