|
-
May 27th, 2004, 04:55 AM
#1
Thread Starter
Fanatic Member
Calling response.redirect from within a class *RESOLVED*
I want to use
VB Code:
response.redirect("somepage.aspx")
from within a class.
It is giving me an error
Name 'response' is not declared
I have added the line
VB Code:
imports system.web.HttpResponse
but that doesn't help.
Last edited by davidrobin; May 27th, 2004 at 09:05 AM.
-
May 27th, 2004, 06:27 AM
#2
You can't use response.redirect from an external class, check this post for more info.
-
May 27th, 2004, 06:44 AM
#3
I wonder how many charact
You most certainly can redirect the page from an external class. You simply pass a reference to the page (or its HTTPContext and call the htttpcontext.response.redirect).
VB Code:
Dim G As myExternalClass
G.myexternalFunction(x, y, Me.Page)
....
Public MyExternalClass
Public Function myExternalFunction (x as Integer, y As Integer, refPage As Page)
If X>Y Then Response.Redirect("http://www.google.com")
End Function
Last edited by nemaroller; May 27th, 2004 at 06:47 AM.
-
May 27th, 2004, 06:50 AM
#4
My Apologies but a similar method was described in the thread i linked wasn't it?
-
May 27th, 2004, 07:01 AM
#5
I wonder how many charact
Yes, and I posted the reference passing method for that too.
In that post, the user may also have security access permission errors however, which they would have to solve using assertions.
-
May 27th, 2004, 09:05 AM
#6
Thread Starter
Fanatic Member
Thanks for your replies.
I keep getting 'page is undefined' errors on the following line
VB Code:
Sub New(ByRef RefPage As page)
Last edited by davidrobin; May 27th, 2004 at 09:33 AM.
-
May 27th, 2004, 11:25 AM
#7
PowerPoster
The type you are trying to pass is:
System.Web.UI.Page
Make sure you have a ref to the System.Web assembly and use the full qualified type name or add a namespace to System.Web.UI.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|