[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

Response.Redirect

I have a application project that has all .cs files. My main project References to the application. In one of my .cs file I have a method that I want to redirect to another page every time it's called. I did Response.Redirect(""); but it says The type or namespace name 'Response' could not be found (are you missing a using directive or an assembly reference?)
Any clue on where to go from here?
0
Karla77
Asked:
Karla77
  • 3
  • 3
1 Solution
 
Bob LearnedCommented:
If you are calling this from a class file, then you need:

System.Web.HttpContext.Current.Response

Bob
0
 
jeebukarthikeyanCommented:
hi,
response.redirect will work only if the page is inherited from  System.Web.UI.Page
i think u have written Response.reditect in a class file

b u d d h a
0
 
Karla77Author Commented:
If you can't use Response.redirect in a .cs file is there something like Response.redirect that you can use.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Bob LearnedCommented:
You can use Response.Redirect in a .cs file, you just need to use what I showed above.

System.Web.HttpContext.Current.Response.Redirect

Bob
0
 
Karla77Author Commented:
I tried that and I still got The type or namespace name 'HttpContext' does not exist in the class or namespace 'System.Web' (are you missing an assembly reference?)

System.Web.HttpContext.Current.Response.Redirect("");

Is there something else I might have missed?
0
 
Bob LearnedCommented:
Do you have a reference to System.Web.dll in the project?

Bob
0
 
Karla77Author Commented:
yes I do.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now