小编ter*_*ško的帖子

ASP.NET MVC中的RSS源

您如何推荐在ASP.NET MVC中处理RSS Feeds?使用第三方库?使用BCL中的RSS东西?只是制作一个呈现XML的RSS视图?还是完全不同的东西?

rss asp.net-mvc

112
推荐指数
5
解决办法
4万
查看次数

目录不存在.参数名称:directoryVirtualPath

我刚刚将我的项目发布到Arvixe上的主机并得到此错误(本地工作正常):

Server Error in '/' Application.

Directory does not exist.
Parameter name: directoryVirtualPath

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Directory does not exist.
Parameter name: directoryVirtualPath

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be …
Run Code Online (Sandbox Code Playgroud)

c# iis asp.net-mvc asp.net-mvc-4

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

使用jQuery Ajax将对象列表传递到MVC控制器方法

我正在尝试使用jQuery的ajax()函数将一个对象数组传递给MVC控制器方法.当我进入PassThing()C#控制器方法时,参数"things"为null.我已经尝试使用一种List作为参数,但这也不起作用.我究竟做错了什么?

<script type="text/javascript">
    $(document).ready(function () {
        var things = [
            { id: 1, color: 'yellow' },
            { id: 2, color: 'blue' },
            { id: 3, color: 'red' }
        ];

        $.ajax({
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            type: 'POST',
            url: '/Xhr/ThingController/PassThing',
            data: JSON.stringify(things)
        });
    });
</script>

public class ThingController : Controller
{
    public void PassThing(Thing[] things)
    {
        // do stuff with things here...
    }

    public class Thing
    {
        public int id { get; set; }
        public string color { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc jquery

107
推荐指数
7
解决办法
24万
查看次数

MVC如何从模型中显示字节数组图像

我有一个模型,我想在页面上显示一个字节数组图像文件.

如何在不返回数据库的情况下执行此操作?

我看到的所有解决方案都使用ActionResult返回数据库来检索图像,但我已经在模型上有了图像......

c# asp.net-mvc razor

105
推荐指数
7
解决办法
14万
查看次数

ASP.NET MVC性能

我发现ASP.NET MVC比ASP.NET WebForms快30倍.有什么真正的性能差异,这是衡量和性能的好处.

这是为了帮助我考虑从ASP.NET WebForms迁移到ASP.NET MVC.

asp.net asp.net-mvc performance webforms

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

ASP.NET MVC - 将参数传递给控制器

我有一个控制器,其动作方法如下:

public class InventoryController : Controller
{
    public ActionResult ViewStockNext(int firstItem)
    {
        // Do some stuff
    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,我得到一个错误说明:

参数字典不包含参数'firstItem'的类型'System.Int32'的有效值.要使参数可选,其类型应为引用类型或Nullable类型.

我让它在某一点工作,我决定尝试没有参数的功能.发现控制器不是持久的我将参数重新放入,现在它在调用方法时拒绝识别参数.

我正在使用此url语法来调用该操作:

http://localhost:2316/Inventory/ViewStockNext/11
Run Code Online (Sandbox Code Playgroud)

任何想法为什么我会得到这个错误以及我需要做些什么来解决它?

我已经尝试添加另一个方法,该方法将一个整数带到类中,它也因为同样的原因而失败.我尝试添加一个带字符串的字符串,并将字符串设置为null.我已经尝试添加一个没有参数,并且工作正常,但当然它不适合我的需要.

c# asp.net-mvc

102
推荐指数
7
解决办法
33万
查看次数

如何在NodeJs应用程序和模块中正确地重用与Mongodb的连接

我一直在阅读和阅读,但仍然对在整个NodeJs应用程序之间共享相同数据库(MongoDb)连接的最佳方式感到困惑.据我所知,应用程序启动时应该打开连接,并在模块之间重用.我目前对最佳方法的想法是server.js(所有内容开始的主文件)连接到数据库并创建传递给模块的对象变量.连接后,模块代码将根据需要使用此变量,此连接将保持打开状态.例如:

    var MongoClient = require('mongodb').MongoClient;
    var mongo = {}; // this is passed to modules and code

    MongoClient.connect("mongodb://localhost:27017/marankings", function(err, db) {
        if (!err) {
            console.log("We are connected");

            // these tables will be passed to modules as part of mongo object
            mongo.dbUsers = db.collection("users");
            mongo.dbDisciplines = db.collection("disciplines");

            console.log("aaa " + users.getAll()); // displays object and this can be used from inside modules

        } else
            console.log(err);
    });

    var users = new(require("./models/user"))(app, mongo);
    console.log("bbb " + users.getAll()); // not connected at …
Run Code Online (Sandbox Code Playgroud)

javascript mongodb node.js express

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

在IIS7上使用MVC3时如何启用gzip压缩?

有谁知道如何在MVC 3中启用gzip压缩?我正在使用IIS7.

Google Chrome Audit的结果:

  1. 启用gzip压缩(4)
  2. 使用gzip压缩以下资源可以将传输大小减少大约三分之二(~92.23KB):
  3. / mydomain /可以节省~1.53KB
  4. jquery-1.4.4.min.js可以节省~51.35KB
  5. Cufon.js可以节省~11.89KB
  6. Futura.js可以节省~27.46KB

compression iis asp.net-mvc gzip asp.net-mvc-3

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

CodeIgniter - 在视图中访问$ config变量

我经常需要访问$config视图中的变量.我知道我可以将它们从控制器传递给load->view().但明确地做这件事似乎过分了.

是否有一些方法或技巧可以$config从CI视图访问变量而不会打扰带有备用代码的控制器?

php codeigniter

97
推荐指数
4
解决办法
13万
查看次数

为什么没有Guid.IsNullOrEmpty()方法

这让我想知道为什么.NET中的Guid没有IsNullOrEmpty()方法(空的意思是全零)

在编写REST API时,我需要在ASP.NET MVC代码的几个地方使用它.

或者我错过了什么,因为互联网上没有人要求同样的东西?

c# asp.net-mvc

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