Member Avatar for CriticalError
CriticalError

Hi i am building a website using ASP.net Razor Syntax (webapges)

I am using C# and can't get response.redirect to work.

This is my code:

 Response.Redirect("~/sitedown.cshtml");

I have put @using System.Web.WebPages() at the top of the page.

The error message is:

CS0103: The name 'Response' does not exist in the current context

Line 16 (thats the code part)

What I am doing wrong? Which namespace do I need so it can recognize the Response.Redirect?

I am also tried this:

WebPageRenderingBase.Response.Redirect("~/sitedown.cshtml");

The got this error:

CS0120: An object reference is required for the non-static field, method, or property 'System.Web.WebPages.WebPageRenderingBase.Response.get'

Please someone clear this up thanks!