使用global.asax [英] using global.asax

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

问题描述

你好,


在Microsoft Visual Studio .NET 2003上,


我想使用一些全局元素,

可以在我的每个页面中使用。

即我将oleDBConnection放在global.asax.vb上


我该如何使用它(在global.asa.vb上的oleDBConnection)在另一个aspx

页面?

需要示例代码。


谢谢:)

Hello,

On Microsoft Visual Studio .NET 2003,

I want to use some global elements,
that can be used in each one of my pages.
i.e I put a oleDBConnection on global.asax.vb

How can I use it (the oleDBConnection on global.asa.vb) at the other aspx
pages ?
Need sample code, please.

Thanks :)

推荐答案

为什么你需要使用global.asax来做这样的事情????


这是ASP时间......


如果你需要指定一个可以通过任何

页面访问的连接字符串,你应该使用web .config文件。

在应用程序启动时从web .config获取并添加应用程序缓存。

通过应用程序缓存访问连接字符串。但是尝试重新设计

您的架构至少是两层应用....不要从网页访问数据库

....
< br $>
-


谢谢,

Yunus Emre ALP?ZEN

BSc,MCAD.NET


" John M" < nobody@nospam_please.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
Why u need to use global.asax for something like this????

It was in ASP times...

If you need to specify a connection string that can be accessed via any
page, you should use web.config file.
Get it from web .config at application startup and add it application cache.
Access your connection string via application cache. But try to redesign
your architecture as at least two tier application.... Don''t access database
from web pages....

--

Thanks,
Yunus Emre ALP?ZEN
BSc, MCAD.NET

"John M" <nobody@nospam_please.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
您好,

在Microsoft Visual Studio .NET 2003上,

我想使用一些可以在我的每个页面中使用的全局元素。
即我将oleDBConnection放在global.asax.vb上

如何在其他aspx
页面上使用它(global.asa.vb上的oleDBConnection)?
需要请示例代码。

谢谢:)
Hello,

On Microsoft Visual Studio .NET 2003,

I want to use some global elements,
that can be used in each one of my pages.
i.e I put a oleDBConnection on global.asax.vb

How can I use it (the oleDBConnection on global.asa.vb) at the other aspx
pages ?
Need sample code, please.

Thanks :)



所以,


我不明白 - 为什么不使用global.asax?

你所说的数据库连接&访问数据库:web.config

是首选。

(如果我只需要简单的临时变量,我可以使用global.asax)。


我需要一个示例代码。

(使用连接,访问数据库)。


谢谢:)


Yunus Emre ALP?ZEN [MCAD.NET]" <叶*** @ msakademik.net>写在消息

新闻:eD ************** @ TK2MSFTNGP12.phx.gbl ...
So,

I don''t understand - why not using global.asax ?
what you said is for database connection & accessing database : web.config
is preferred.
(If I need just simple temporary variables, I can use the global.asax).

I need a sample code, please.
(using connection, and accessing the database).

Thanks :)

"Yunus Emre ALP?ZEN [MCAD.NET]" <ye***@msakademik.net> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...
为什么你需要使用global.asax用于这样的事情????

这是在ASP时代...

如果你需要指定一个可以通过任何<访问的连接字符串br />页面,你应该使用web.config文件。
在应用程序启动时从web .config获取它并添加它应用程序
缓存。通过应用程序缓存访问连接字符串。但是尝试将您的架构重新设计为至少两层应用程序....不要从网页访问数据库....

-

谢谢,
Yunus Emre ALP?ZEN
BSc,MCAD.NET

John M < nobody@nospam_please.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
Why u need to use global.asax for something like this????

It was in ASP times...

If you need to specify a connection string that can be accessed via any
page, you should use web.config file.
Get it from web .config at application startup and add it application
cache. Access your connection string via application cache. But try to
redesign your architecture as at least two tier application.... Don''t
access database from web pages....

--

Thanks,
Yunus Emre ALP?ZEN
BSc, MCAD.NET

"John M" <nobody@nospam_please.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
你好,

在Microsoft Visual Studio .NET 2003上,

我想使用一些全局元素,
可以在我的每个页面中使用。
即我放global.asax.vb上的oleDBConnection

如何在其他aspx
页面上使用它(global.asa.vb上的oleDBConnection)?
需要示例代码,请。

谢谢:)
Hello,

On Microsoft Visual Studio .NET 2003,

I want to use some global elements,
that can be used in each one of my pages.
i.e I put a oleDBConnection on global.asax.vb

How can I use it (the oleDBConnection on global.asa.vb) at the other aspx
pages ?
Need sample code, please.

Thanks :)




....此外 - 我认为是网络。 config不支持* .mdb,但是支持sql

服务器 - 这是真的吗?

(我使用的是* .mdb)


谢谢:)


" John M" < nobody@nospam_please.com>写在消息

新闻:%2 *************** @ TK2MSFTNGP12.phx.gbl ...
.... besides - I think that web.config doesn''t support *.mdb, but support sql
server - Is that true ?
(what I use is *.mdb)

Thanks :)

"John M" <nobody@nospam_please.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
所以,

我不明白 - 为什么不使用global.asax?
你说的是数据库连接&访问数据库:web.config
是首选。
(如果我只需要简单的临时变量,我可以使用global.asax)。

我需要一个示例代码,请。
(使用连接,访问数据库)。

谢谢:)

Yunus Emre ALP?ZEN [MCAD.NET]" <叶*** @ msakademik.net>在消息中写道
新闻:eD ************** @ TK2MSFTNGP12.phx.gbl ...
So,

I don''t understand - why not using global.asax ?
what you said is for database connection & accessing database : web.config
is preferred.
(If I need just simple temporary variables, I can use the global.asax).

I need a sample code, please.
(using connection, and accessing the database).

Thanks :)

"Yunus Emre ALP?ZEN [MCAD.NET]" <ye***@msakademik.net> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...
为什么你需要使用global.asax像这样的东西????

这是在ASP时代...

如果你需要指定一个可以通过任何页面访问的连接字符串,你应该使用web.config文件。
在应用程序启动时从web .config获取它并添加它应用程序
缓存。通过应用程序缓存访问连接字符串。但是尝试将您的架构重新设计为至少两层应用程序....不要从网页访问数据库....

-

谢谢,
Yunus Emre ALP?ZEN
BSc,MCAD.NET

John M < nobody@nospam_please.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
Why u need to use global.asax for something like this????

It was in ASP times...

If you need to specify a connection string that can be accessed via any
page, you should use web.config file.
Get it from web .config at application startup and add it application
cache. Access your connection string via application cache. But try to
redesign your architecture as at least two tier application.... Don''t
access database from web pages....

--

Thanks,
Yunus Emre ALP?ZEN
BSc, MCAD.NET

"John M" <nobody@nospam_please.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
你好,

在Microsoft Visual Studio .NET 2003上,

我想使用一些全局元素,
可以在我的每个页面中使用。
即我放global.asax.vb上的oleDBConnection

如何在其他
aspx页面上使用它(global.asa.vb上的oleDBConnection)?
需要示例代码,请。

谢谢:)
Hello,

On Microsoft Visual Studio .NET 2003,

I want to use some global elements,
that can be used in each one of my pages.
i.e I put a oleDBConnection on global.asax.vb

How can I use it (the oleDBConnection on global.asa.vb) at the other
aspx pages ?
Need sample code, please.

Thanks :)





这篇关于使用global.asax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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