我上课Items了properties (Id, Name, Code, Price).
列表中Items填充了重复的项目.
例如:
1 Item1 IT00001 $100
2 Item2 IT00002 $200
3 Item3 IT00003 $150
1 Item1 IT00001 $100
3 Item3 IT00003 $150
Run Code Online (Sandbox Code Playgroud)
如何使用linq删除列表中的重复项?
我改变了PC/Windows(XP - > 7)所以IIS(6 - > 7,5)并试图移动我的网站
但我无法从此服务器运行我的网站...错误:
错误说明:错误HTTP 500.19 - 内部服务器错误
由于此页面的配置数据不正确,请求的页面不可用.
错误详细信息模块IIS Web核心通知BeginRequest处理程序尚未确定错误0x80070021配置错误此配置部分不能以这种方式使用.当该部分在父级别锁定时会发生这种情况.默认情况下锁定(overrideModeDefault ="Deny"),或者使用overrideMode ="Deny"或继承属性allowOverride ="false"直接由标记位置安装.配置文件\ \?\ D:\ Projects\Flow WEB\Sources\web.config请求的URL地址https:// 192.168.0.172:443 /物理路径D:\ Projects\Flow WEB\Sources登录方法尚未确定已登录的用户尚未确定的频道
组态
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
Run Code Online (Sandbox Code Playgroud)
...
我的web.config部分:
<modules>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, …Run Code Online (Sandbox Code Playgroud) 有没有办法,我可以用javascript读取web.config中的配置值?我为什么要那样做?
我的网站上有一个计时器,如果用户处于非活动状态20分钟,它会弹出一个带倒计时器的模态对话框(倒计时2分钟).如果用户没有回应,则会将其记录下来.如果他这样做,它会ping到服务器(以维持会话)并使会话保持活动状态
这15分钟是在js文件中硬编码的.我宁愿想从配置文件/其他文件中获取它,而不是将其硬编码到JS中
这是代码片段
$.fn.idleTimeout = function(options) {
var defaults = {
//I would like to pick these values from some config file
inactivity: 900000, //15 minutes
noconfirm: 120000, //2 minutes
sessionAlive: 900000, //15 minutes
click_reset: true,
logout_url: '/Views/Pages/Timeout.aspx'
}
Run Code Online (Sandbox Code Playgroud)
有什么建议?
编辑:这是一个单独的js文件.执行<%=%>会出现错误"非法XML字符[中断此错误]不活动:<%= ConfigurationManager.AppSettings ["Inactivity"]%>;"
我有一些逻辑,我已经把它放在reducer中,我认为应该把它放在Action中并传递下去?
将这类东西放入动作或减速器中是最佳做法吗?
这里的工作示例.
减速机代码:
function Card() {
this.card = (Math.random()*4).toFixed(0);
}
Card.prototype = {
getRandom: function(){
var card;
//console.log(this.card)
switch (this.card) {
case '1':
card = 'heart';
break;
case '2':
//card = 'diamonds';
card = 'heart'; // weight the odds abit
break;
case '3':
card = 'club';
break;
case '4':
card = 'spade';
break;
default:
card = 'heart';
break;
}
return card;
}
}
var dealer = {
deal: function(){
var results = [];
for(var i = 0; i …Run Code Online (Sandbox Code Playgroud) 在呈现视图之前,是否可以让我的应用程序询问用户名和密码提示?就像在twitter API上获取有关您帐户的信息一样:
http://twitter.com/account/verify_credentials.xml
所以在渲染视图之前|| 文件它要求您插入用户名和密码,我认为这是直接在服务器上进行的,因为curl请求基于用户名:密码以及如下所示:
curl -u user:password http://twitter.com/account/verify_credentials.xml
Run Code Online (Sandbox Code Playgroud)
在我尝试使用相同的结构构建API时,我想知道如何在ASP.NET MVC C#上执行此操作.我已经在ruby rails上使用了它,它非常简单:
before_filter :authenticate
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "foo" && password == "bar"
end
Run Code Online (Sandbox Code Playgroud)
我不认为[授权]过滤器是相同的,因为我认为它只是一个重定向,它将您重定向到基于帐户数据库的帐户内部控制器,在这种情况下,我将使用另一个数据库,特别是从webservice并在提交信息后进行验证.但我需要动作来要求用户并在其请求上传递凭据.
提前致谢
更新:
实际上,要请求一个需要此身份验证的页面(即Twitter),我必须在其请求中声明这一点
request.Credentials = new NetworkCredential("username", "password");
Run Code Online (Sandbox Code Playgroud)
这将反映出提示的用户名和密码.
所以,它是完全相同的,但从另一方面来说,如果可以根据请求向身份验证提示提供信息,我怎么能在请求中要求这种身份验证呢?
因此,每次有人试图通过示例向我的应用程序发出请求:
HTTP://为MyApplication /客户/ verify_credentials
它应该询问服务器提示符的用户名和密码,以便在curl上检索信息,例如它就像这样
curl -u user:password http://myapplication/clients/verify_credentials
Run Code Online (Sandbox Code Playgroud) 我有一个ASP.Net网站,我想使用自定义错误页面.我将以下代码放在我的web.config中
<customErrors mode="On" defaultRedirect="~/error.aspx">
<error statusCode="404" redirect="~/error.aspx" />
</customErrors>
Run Code Online (Sandbox Code Playgroud)
问题是当我转到不存在的URL仍然使用IIS管理器中指定的404错误页面时.
问题:如何使用我创建的error.aspx页面?为什么IIS管理器中的设置会覆盖web.config?
如果我认为可能,我如何修改我的web.config以使子目录静态 - 内部文件只会作为静态文件处理,即使它的名称是"aspx"或其他什么?谢谢.
我Web.Config在ASP.NET MVC 2项目中配置了我的文件:
<sessionState mode="InProc" timeout="1"/>
Run Code Online (Sandbox Code Playgroud)
并添加以下内容Global.asax.cs:
protected void Session_End(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Session_End");
}
protected void Session_Start(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("Session_Start");
}
Run Code Online (Sandbox Code Playgroud)
Session_Start()在新用户访问网站时调用.我希望Session_End()在1分钟的空闲时间之后被召唤,但事实并非如此.我错过了什么吗?
我学习使用.Net的内置配置文件提供程序,并遇到以下问题:
我读到可以通过.Net-Application的web.config-settings覆盖machine.config-settings.machine.config文件中的以下设置与我相关:
<connectionStrings>
<add name="LocalSqlServer" connectionString="Data Source=(local);Initial Catalog=aspnetdb;
Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<profile><providers><add name="AspNetSqlProfileProvider"connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></providers></profile>
Run Code Online (Sandbox Code Playgroud)
这些设置用于设置本地配置文件.但是,当我将设置复制到我的应用程序的web.config并更改machine.config设置,以便它们不再工作时,我收到配置错误.例如,我将machine.config中提供程序的名称更改为"Local".这应该没问题,因为覆盖了设置.但是,在运行应用程序时,我收到错误:
"条目"AspNetSQLProvider已经添加"(我的翻译)
我在部署网站时看到了关于类似错误的一些问题,但在Visual Studio中构建 ASP.NET MVC网站时,我似乎随机得到了这个错误.执行清理通常会修复它,但有没有办法完全避免这种情况?
在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的.d:\ OBJ \调试\包\ packagetmp \的web.config
请注意,它抱怨root web.config,而不是Views子目录中的root .
web-config ×7
asp.net ×4
asp.net-mvc ×3
javascript ×2
c# ×1
generic-list ×1
http ×1
httphandler ×1
iis ×1
iis-7 ×1
linq ×1
reactjs ×1
redux ×1
security ×1