如何使用"Response.Redirect"?或"Server.Transfer" .vb类文件中的方法 [英] How is it possible to use the "Response.Redirect" or the "Server.Transfer" method in a .vb class file

查看:117
本文介绍了如何使用"Response.Redirect"?或"Server.Transfer" .vb类文件中的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

是否有可能无法使用"Response.Redirect"?或"Server.Transfer" .vb类文件中的方法?

例如,我正在使用VS 2010,如果用户已取消帐户,则尝试将用户重定向到另一个asp表单.

当在.vb类文件中编写代码时,响应"会在屏幕上显示.类文件可以识别".Redirect"方法,但是智能不能识别".Redirect".我看到一条消息,告诉我对非共享成员的引用需要对象引用".

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?

推荐答案

编译器看到的是Response类,而不是页面的Response属性.

您可以尝试将页面传递给您的班级.这将允许您访问"thePage.Response".

另外,HttpContext.Current.Response可能也可以.
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.


这篇关于如何使用"Response.Redirect"?或"Server.Transfer" .vb类文件中的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆