Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ADO.NET redirecting
Hello,
 
Is it not possible to use the "Response.Redirect" or the "Server.Transfer" method within a .vb class file?
 
For an example I am using VS 2010 and I am trying to redirect the user to another asp form if he or she has a canceled account.
 
When writing the code in a .vb class file the "Response" method is recognized by the class file, but the intellisence does not recognize ".Redirect". I see a message telling me that "reference to non-shared member requires an object reference".
 
Is there a solution to redirect the user to a different page?
Posted 22-Jun-12 9:19am
Edited 22-Jun-12 9:34am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The compiler sees the Response class not the Response property of the page.
 
You could try to pass the page to your class. This will allow you to access 'thePage.Response'.
 
Alternatively HttpContext.Current.Response might work.
  Permalink  
Comments
Manas Bhardwaj at 23-Jun-12 17:31pm
   
correct +5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 385
1 Sergey Alexandrovich Kryukov 195
2 Prakriti Goyal 177
3 jlopez788 134
4 Kruti Joshi 117
0 OriginalGriff 6,742
1 Sergey Alexandrovich Kryukov 5,479
2 Maciej Los 3,474
3 Peter Leow 3,313
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 23 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100