如何在global.asax页面中获取ID [英] how to Get ID in global.asax page

查看:72
本文介绍了如何在global.asax页面中获取ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在vb.net 2005中开发Web应用程序.
default.aspx是主页,而mailutil.vb是从该Web应用程序中的应用程序代码"文件夹中引用的.
我想将ID从aspx页面传递到Application code文件夹中的mailutil.vb页面.我无法在该页面中使用查询字符串,会话,Cookie.

有什么方法吗?

我想将一个ID从.aspx页面传递给该函数到mailutil.vb


在此先感谢..

问候,

Sasikumar

Hi,
I am working on a web application in vb.net 2005.
default.aspx is a main page and mailutil.vb is referred from Application code folder in that web application.

I want to pass ID from aspx page to mailutil.vb page in Application code folder. I can''t use query string,session,cookies in that page.

Is there any method ?

I want to pass a ID to that function from a .aspx page to mailutil.vb


thanks in advance..

regards,

Sasikumar

推荐答案

首先可以使用Session,Request,Response,Server等.
如果我理解正确,mailutil.vb是一个类.

1.添加到此类:
First of all you can use Session, Request, Response, Server, etc.
If I understood you correctly mailutil.vb is a class.

1. Add to this class:
using System.Web;


2.在要检索的方法中,说Session ["myPassedID"]获取会话对象:


2. In the method where you want to retrieve say Session["myPassedID"] get the session object:

System.Web.SessionState.HttpSessionState session = HttpContext.Current.Session;

string myID = session["myPassedID"];



祝您好运



Good luck


您能否仅将它作为default.aspx.vb中的一个参数传递:
can you not just pass it as a parameter from your default.aspx.vb:

Dim someParam as Int
someParam = 123

mailutil.SomeMethod(someParam)



还是我错过了什么?



or am I missing something?


我无法完全理解您的问题.
只需在您的mailutil.vb的类中保留一个公共静态变量

语法:
公用共享的dim id为String

这样一来,您就可以在不需任何地方创建实例的情况下对其进行读/写操作
(mailutil.id)
I could not understand y''r question thoroughly.
Just keep a public static variable in your mailutil.vb''s class

Syntax:
Public Shared dim id as String

Then you''ll be able to read/write to it without creating an instance as you wish from anywhere
(mailutil.id)


这篇关于如何在global.asax页面中获取ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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