草庐IT

current_session_context_class

全部标签

c# - 公共(public)静态字符串 MyFunc() 上的 "Expected class, delegate, enum, interface or struct"错误。什么 's an alternative to "字符串”?

当我尝试使用以下静态函数时出现错误。错误:Expectedclass,delegate,enum,interface,orstruct函数(和类):namespaceMyNamespace{publicclassMyClass{//SomeotherstaticmethodsthatuseClasses,delegates,enums,interfaces,orstructspublicstaticstringMyFunc(stringmyVar){stringmyText=myVar;//DosomestuffwithmyTextandmyVarreturnmyText;}}}这导致

c# - ASP.NET + C# HttpContext.Current.Session 为空(WebService 内部)

这是我发起session的方式protectedvoidSession_Start(objectsender,EventArgse){HttpContext.Current.Session["CustomSessionId"]=Guid.NewGuid();}在我的类库下的解决方案中,我正在尝试访问它并获得空异常:stringsess=HttpContext.Current.Session["CustomSessionId"];这是我在web.config和app.config中的配置(在我的库中)(应用程序配置) 最佳答案 根据您

c# - "This application can only run in the context of an app container."- Visual Studio 2015 开发新功能

我有点绝望。几个小时以来,我一直在努力解决以下问题。我开发了一个应用程序,我现在尝试使用VisualStudio2015的安装向导扩展来安装它。一切都在构建或(没有错误)但是当我打开应用程序时它突出显示它只能在应用程序容器的上下文中打开。那是什么意思?任何建议将不胜感激!该应用正在使用SQlite数据库。这可能与依赖关系有关吗?如果是这样,我该如何解决这个问题?更新:#Culture="en-US"ConvertFrom-StringData@'###PSLOCPromptYesString=&YesPromptNoString=&NoBundleFound=Foundbundle:{

c# - C# 中 Windows 窗体应用程序的 session

是否有针对基于Windows的C#应用程序的session,以便记录多个用户登录和注销的详细信息?我尝试使用声明静态变量,但它与session不同。 最佳答案 Windows窗体中没有session变量的概念。你可以这样做:创建一个静态类,用于保存用户名和密码以及整个应用程序所需的任何其他变量。在你的情况下它会是这样的:publicstaticclassLoginInfo{publicstaticstringUserID;}现在您可以从代码中的任何位置访问UserID:MessageBox.Show(LogInfo.UserID);

c# - 我如何检查 session 是否存在或是否为空值或 .net c# 中的 null

有谁知道如何在.netc#web应用程序中检查session是否为空?例子:我有以下代码:ixCardType.SelectedValue=Session["ixCardType"].ToString();它总是向我显示Session["ixCardType"]错误(错误消息:对象引用未设置为对象的实例)。无论如何,我可以在转到.ToString()之前检查session?? 最佳答案 像“if”这样简单的东西应该可以工作。if(Session["ixCardType"]!=null)ixCardType.SelectedValue

c# - 如何在 jquery 方法中获取 asp.net Session 值?

我想在ASP.NETMVCView页面中访问jquery方法中的Session值。看下面的代码,$('input[type=text],select,input[type=checkbox],input[type=radio]').attr('disabled','');如何在jquery中获取Session值。 最佳答案 $('input,select').attr('disabled',''); 关于c#-如何在jquery方法中获取asp.netSession值?,我们在Stack

c# - OOPS 概念 : What is the difference in passing object reference to interface and creating class object in C#?

我有一个类CustomerNew和一个接口(interface)ICustomer:publicclassCustomerNew:ICustomer{publicvoidA(){MessageBox.Show("Classmethod");}voidICustomer.A(){MessageBox.Show("Interfacemethod");}publicvoidB(){MessageBox.Show("ClassMethod");}}publicinterfaceICustomer{voidA();}我对这两行代码很困惑。ICustomerobjnew=newCustomerNe

c# - "Inspecting the state of an object in the debuggee of type System.Reflection.MethodBase is not supported in this context"

我不知道这个错误是什么意思。我使用的是VisualStudioforMac7.5.0社区版。我在带有ASP.NETCore的EntityFramework中使用延迟加载。publicpartialclassAdminUser{publicAdminUser(){RoleAssign=newHashSet();}publicGuidUserId{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}publicstringEmail{get;set;}publicstringUserName{get;s

c# - 从另一个线程访问 session 数据

我这里有个问题。在我的网络应用程序中,我有一个页面启动另一个线程来完成耗时的任务。在这个新线程中,我调用了我的一种架构方法(在另一个项目中-一个架构项目)。问题是:在其中一种方法中,我访问了HttpContext.Current.Session字段。但是,当我启动应用程序时,会抛出一个异常,提示此对象(HttpContext.Current.Session)具有空引用。我如何将新线程的上下文设置为与HttpApplication上下文相同以便访问HttpContext.Current.Session? 最佳答案 这里有很多事情需要考

c# - HttpContext.Current.Items 的范围

当Server.Transfer();发生时,HttpContext.Current.Items是否丢失?如果是这样,我将信息发送到另一个页面的最佳方式是什么不通过session? 最佳答案 是的,上下文仍然有效。如果您使用Response.Redirect(),它将变得无效或中断。参见文章TheHttpContextItemsCollection 关于c#-HttpContext.Current.Items的范围,我们在StackOverflow上找到一个类似的问题: