I want to use
from within a class.VB Code:
response.redirect("somepage.aspx")
It is giving me an error
I have added the lineQuote:
Name 'response' is not declared
but that doesn't help.VB Code:
imports system.web.HttpResponse
Printable View
I want to use
from within a class.VB Code:
response.redirect("somepage.aspx")
It is giving me an error
I have added the lineQuote:
Name 'response' is not declared
but that doesn't help.VB Code:
imports system.web.HttpResponse
You can't use response.redirect from an external class, check this post for more info.
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
My Apologies but a similar method was described in the thread i linked wasn't it?
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.
Thanks for your replies.
I keep getting 'page is undefined' errors on the following lineVB Code:
Sub New(ByRef RefPage As page)
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.