找不到类型或名称空间名称"WebContext"(您是否缺少using指令或程序集引用?) [英] The type or namespace name 'WebContext' could not be found (are you missing a using directive or an assembly reference?)

查看:75
本文介绍了找不到类型或名称空间名称"WebContext"(您是否缺少using指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的app.xaml中,我添加了用于创建登录页面的这些代码
这里的代码:

 公共 App()
        {
             this  .Startup + =  this  .Application_Startup;
            .退出+ =  .Application_Exit;
             .UnhandledException + =  .Application_UnhandledException;

            InitializeComponent();
            setAuthenticationContext();
        }
        私有 无效 setAuthenticationContext()
{
  var  webcontext =  WebContext 
{
验证=

 FormsAuthentication()
};
 .ApplicationLifetimeObjects.Add(webcontext);
} 


但是我在webcontext上有错误,请帮助我解决它

解决方案

作为
  var  webcontext =  WebContext ()
{
验证=

 FormsAuthentication()
}; 


in my app.xaml i added these codes for making a login page
here the codes:

public App()
        {
            this.Startup += this.Application_Startup;
            this.Exit += this.Application_Exit;
            this.UnhandledException += this.Application_UnhandledException;

            InitializeComponent();
            setAuthenticationContext();
        }
        private void setAuthenticationContext()
{
var webcontext = new WebContext
{
Authentication =

new FormsAuthentication()
};
this.ApplicationLifetimeObjects.Add(webcontext);
}


but i have a error on webcontext , plz help me to solve it

As the documentation states[^], you have to put a reference to the System.Web assembly (on Visual Studio, menu item Project->Add reference...).


Add "()" at the line new WebContext

var webcontext = new WebContext()
{
Authentication =

new FormsAuthentication()
};


这篇关于找不到类型或名称空间名称"WebContext"(您是否缺少using指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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