Solved

Response.Redirect

Posted on 2010-08-16
6
475 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
ID: 33449070
Imports System.IO
0
 
LVL 2

Accepted Solution

by:
larkvale earned 125 total points
ID: 33449211
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
ID: 33449643
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Assisted Solution

by:dost2010
dost2010 earned 125 total points
ID: 33455208
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
ID: 33455533
@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
ID: 33455740
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 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