Sandra
Sandra

Reputation: 63

Cannot redirect after HTTP headers have been sent

I'm using MVCContrib and its EmailTemplateService to send html email. Send email works fine but it doesn't seem to dispose email view properly. When I try to redirect to a new Action it gives the following error:

"Cannot redirect after HTTP headers have been sent"

Does anyone know how to fix this problem. Many thanks

Sandra

Upvotes: 0

Views: 2851

Answers (1)

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171411

Try this:

if (!Response.IsRequestBeingRedirected)
    //do the redirect

Upvotes: 1

Related Questions