小编Nit*_*ant的帖子

如何在asp.net中实现"Access-Control-Allow-Origin"标头

是否可以在asp.net中实现"Access-Control-Allow-Origin"标头

c# asp.net iis

33
推荐指数
3
解决办法
11万
查看次数

什么是`KeyValuePair <string,int>`的默认值?

什么是默认值KeyValuePair<string, int>

例如,我正在运行LINQ查询并FirstOrDefault()从中返回值

KeyValuePair<string, int> mapping = (from p in lstMappings
    where p.Key.Equals(dc.ColumnName, StringComparison.InvariantCultureIgnoreCase)
    select p).FirstOrDefault();

if (mapping != null)
{ 

}
Run Code Online (Sandbox Code Playgroud)

如何检查mapping对象是否为空/空
(我在上面的代码中得到编译时错误Operator '!=' cannot be applied to operands of type 'System.Collections.Generic.KeyValuePair<string,int>' and '<null>')

PS:lstMappings属于类型

List<KeyValuePair<string, int>>
Run Code Online (Sandbox Code Playgroud)

c# linq

27
推荐指数
3
解决办法
3万
查看次数

Windows集成(NTLM)身份验证与Windows集成(Kerberos)

Windows集成(NTLM)身份验证和Windows集成(Kerberos)之间有什么区别?

如何在IIS6中实现这些

wrt MSDN

c# asp.net ntlm iis-6 kerberos

11
推荐指数
2
解决办法
2万
查看次数

是否可以在Gmail中使用谷歌网络字体

我想在gmail中编写邮件时使用谷歌网络字体"Over the Rainbow"

 <link href='http://fonts.googleapis.com/css?family=Over+the+Rainbow&v2' rel='stylesheet' type='text/css'>
Run Code Online (Sandbox Code Playgroud)

可能吗?

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Over+the+Rainbow' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); </script>
Run Code Online (Sandbox Code Playgroud)

email gmail google-webfonts

10
推荐指数
1
解决办法
1万
查看次数

从父视图提交部分视图数据

如何从父视图提交部分视图数据.

我是MVC的新手,
我创建了一个局部视图_CurrentData,其中包含编辑器控件 - 文本框等,
并在主视图中添加了Submit按钮:

<div class="row">
    <div class="col-md-12">
        @Html.Partial("_CurrentData", Model.CurrentItemDetails)
    </div>
</div>
<div class="row">
    <div class="col-md-2 col-md-offset-5">
        <div>
            <input type="button" class="btn btn-primary" value="Submit" id="btnSubmit"/>
            &nbsp;&nbsp;
            <input type="button" class="btn btn-primary" value="Cancel" id="btnCancel" />
            <br/><br />
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

视图模型

public class ProductionViewModel
{
    public ItemDetails CurrentItemDetails { get; set; }
}

public class ItemDetails
{
    public int ID { get; set; }
    public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

视图

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 …
Run Code Online (Sandbox Code Playgroud)

javascript asp.net-mvc jquery razor

8
推荐指数
1
解决办法
1万
查看次数

什么{"d":""}表示在asp.net webservice响应中

我创建了一个简单的C#asp.net Web服务函数,它返回一个字符串消息
,我使用jquery ajax从页面调用它.

C#:

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string HelloWorld() {
    return DateTime.Now.ToString();
}
Run Code Online (Sandbox Code Playgroud)


JS:

    $(document).ready(function() {
    //alert("ready");
        $.ajax({
            type: "POST",
            contentType: "application/json; chatset=utf-8",
            url: "WebService2.asmx/HelloWorld",
            data: "{}",
            dataType: "json",
            success: function(msg) {
                //alert(msg); //doesnt works
                alert(msg.d);
            }
        });
    });
Run Code Online (Sandbox Code Playgroud)

我的问题是,为什么 alert(msg);犯规作品

.net asp.net web-services

7
推荐指数
2
解决办法
2780
查看次数

asp.net网格分页的SQL查询

我使用iBatisSQLServer,

使用偏移和限制进行查询查询的最佳方法是什么?

也许我添加了列ROW_NUMBER() OVER (ORDER BY Id) AS RowNum,但这只会阻止简单查询的数据访问.在某些情况下,我使用选择联合.如何优化这些查询?

c# sql-server asp.net ibatis

6
推荐指数
1
解决办法
1037
查看次数

ASP.NET Web API将http响应转换为json数组



调用REST URL时,我的代码工作正常:http:
//api.feedzilla.com/v1/categories.json

但当我调用以下URL时,我收到错误:http://api.feedzilla.com/v1/categories/15/articles.json?count = 36&theseince:
2012-11-15&client_source =&order = relevance&title_only = 0&

错误:

{"Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.IEnumerable`1[Nitin.News.DAL.Resources.Article]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-web-api

6
推荐指数
1
解决办法
9630
查看次数

如何为枚举列表创建InstanceDescriptor?

类似的问题:将int list作为参数传递给Web用户控件
是否有类似enum类型的示例?

我正在创建一个asp.net自定义控件,我想在其中将逗号分隔的枚举列表作为属性传递.
我正在写一个TypeConverter用于将逗号分隔的字符串值转换为枚举列表.

ConvertTo方法中,
如何为InstanceDescriptor枚举列表创建对象?

我目前的代码如下:

//enum
public enum MyEnum {Hello, World}

//main method
List<MyEnum> list = new List<MyEnum>();
list.Add(MyEnum.Hello);
list.Add(MyEnum.World);
ConstructorInfo constructor = typeof(List<MyEnum>).GetConstructor( Type.EmptyTypes );
InstanceDescriptor idesc = new InstanceDescriptor(constructor, list);
Run Code Online (Sandbox Code Playgroud)

这与消息失败

Length mismatch
Run Code Online (Sandbox Code Playgroud)

我想知道为什么

c# asp.net custom-controls typeconverter typedescriptor

6
推荐指数
1
解决办法
218
查看次数

出现任何未处理的错误时,将显示带有乱码文本的页面

每当发生未处理的错误时,我都会看到屏幕而不是黄色屏幕.

suckr

请注意我已在ASP.NET Boilerplate中启用了本地化,并且当前语言/文化设置为en-US.

对于某些页面,语言文本值存储在AbpLanguageTexts表中.

asp.net error-handling asp.net-mvc-5 aspnetboilerplate

6
推荐指数
1
解决办法
131
查看次数