• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

Response.Redirect

What Import do I need to access Response.Redirect?
0
HLRosenberger
Asked:
HLRosenberger
4 Solutions
 
Anil GolamariCommented:
Imports System.IO
0
 
larkvaleCommented:
Assuming you are writing a ASP .NET Web application ?

Your project should reference System.Web

Response.Redirect is found in System.Web.HttpResponse

Although you should not have to Import anything if your Web project is correctly set up

0
 
Snarf0001Commented:
Assuming that this is a web app, and that you're trying to redirect from a class file or something that doesn't have the context neatly wrapped in, it's the CURRENT response you need access to, via the HttpContext object:

System.Web.HttpContext.Current.Response.Redirect("xxx");
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
dost2010Commented:
If you have created a webproject in the visual studio and running under asp.net then you do not need to import anything to execute response.redirect. Your project might have some setting problems, if you are using response.redirect inside the class which is consumed by asp.net application, remove it from there and refactor your code in a way so that response.redirect is in the page code behind and not in the class
0
 
Snarf0001Commented:
@dost2010, there's no reason to pull a Response.Redirect out of a class file.

The built in Response.Redirect you have in a Page code-behind is referencing exactly the same object as
System.Web.HttpContext.Current as written above, it's just already wired up for you.
0
 
HLRosenbergerAuthor Commented:
You are all correct.  This was user error.  Duh, I had created a normal Windows project and not a WEB project.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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