Solved

Response.Redirect

Posted on 2006-11-08
7
452 Views
Last Modified: 2012-08-14
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
Comment
Question by:Karla77
  • 3
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17897837
If you are calling this from a class file, then you need:

System.Web.HttpContext.Current.Response

Bob
0
 
LVL 13

Expert Comment

by:jeebukarthikeyan
ID: 17897875
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
 

Author Comment

by:Karla77
ID: 17898154
If you can't use Response.redirect in a .cs file is there something like Response.redirect that you can use.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 17898190
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
 

Author Comment

by:Karla77
ID: 17898287
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17898300
Do you have a reference to System.Web.dll in the project?

Bob
0
 

Author Comment

by:Karla77
ID: 17898349
yes I do.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

23 Experts available now in Live!

Get 1:1 Help Now