Solved

Response.Redirect

Posted on 2006-11-08
7
450 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
Comment Utility
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
Comment Utility
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
Comment Utility
If you can't use Response.redirect in a .cs file is there something like Response.redirect that you can use.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
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
Comment Utility
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
Comment Utility
Do you have a reference to System.Web.dll in the project?

Bob
0
 

Author Comment

by:Karla77
Comment Utility
yes I do.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

12 Experts available now in Live!

Get 1:1 Help Now