Solved

Response.Redirect

Posted on 2010-08-16
6
470 Views
Last Modified: 2012-05-10
What Import do I need to access Response.Redirect?
0
Comment
Question by:HLRosenberger
6 Comments
 
LVL 18

Expert Comment

by:Anil Golamari
Comment Utility
Imports System.IO
0
 
LVL 2

Accepted Solution

by:
larkvale earned 125 total points
Comment Utility
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
 
LVL 22

Assisted Solution

by:Snarf0001
Snarf0001 earned 250 total points
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Assisted Solution

by:dost2010
dost2010 earned 125 total points
Comment Utility
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
 
LVL 22

Assisted Solution

by:Snarf0001
Snarf0001 earned 250 total points
Comment Utility
@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
 
LVL 1

Author Closing Comment

by:HLRosenberger
Comment Utility
You are all correct.  This was user error.  Duh, I had created a normal Windows project and not a WEB project.

Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now