我可以访问在Dot net的同一个应用程序中用另一种语言声明的会话变量吗?

时间:2022-02-04 23:49:40

Dot net allow you to develop an application in multiple languages i.e c# vb.net,j# etc. Suppose I develop an application in two languages vb.net and c#. If I declare one session variable in vb.net code and i want to access the same session variable in c# code. Is it possible?

Dot net允许您使用多种语言开发应用程序,即c#vb.net,j#等。假设我使用两种语言vb.net和c#开发应用程序。如果我在vb.net代码中声明一个会话变量,我想在c#代码中访问相同的会话变量。可能吗?

3 个解决方案

#1


Yes this is completely possible. As long as the DLL's from both languages are using the same instance of Session state then variables from language can be accessed from the other.

是的,这是完全可能的。只要来自两种语言的DLL使用相同的Session状态实例,就可以从另一种语言访问语言中的变量。

#2


Yes this is possible assuming your are talking about web applications, and they are within the same site / process

是的,假设您正在讨论Web应用程序,并且它们位于同一站点/进程中,则可以这样做

#3


Your technology is unclear, if you mean Session in the sense of an ASP.NET session then the session is only available to code running in the same application, however the same application can use dlls written in various languages.

您的技术尚不清楚,如果您的意思是ASP.NET会话意义上的Session,那么会话仅适用于在同一应用程序中运行的代码,但是同一个应用程序可以使用以各种语言编写的dll。

If you are refering to global values held in an executable application then again multiple dlls can be included in the application built using different languages. Accessibilty of global values is controlled by, well, their accessibilty modifiers.

如果要引用可执行应用程序中保存的全局值,则可以在使用不同语言构建的应用程序中再次包含多个dll。全局值的可访问性由其可访问性修饰符控制。

#1


Yes this is completely possible. As long as the DLL's from both languages are using the same instance of Session state then variables from language can be accessed from the other.

是的,这是完全可能的。只要来自两种语言的DLL使用相同的Session状态实例,就可以从另一种语言访问语言中的变量。

#2


Yes this is possible assuming your are talking about web applications, and they are within the same site / process

是的,假设您正在讨论Web应用程序,并且它们位于同一站点/进程中,则可以这样做

#3


Your technology is unclear, if you mean Session in the sense of an ASP.NET session then the session is only available to code running in the same application, however the same application can use dlls written in various languages.

您的技术尚不清楚,如果您的意思是ASP.NET会话意义上的Session,那么会话仅适用于在同一应用程序中运行的代码,但是同一个应用程序可以使用以各种语言编写的dll。

If you are refering to global values held in an executable application then again multiple dlls can be included in the application built using different languages. Accessibilty of global values is controlled by, well, their accessibilty modifiers.

如果要引用可执行应用程序中保存的全局值,则可以在使用不同语言构建的应用程序中再次包含多个dll。全局值的可访问性由其可访问性修饰符控制。