2014-1219

用如下方法获取UserId报空引用异常

public class BaseController : Controller
{
    protected SiteContext db = new SiteContext();
    protected Guid userId;
    public BaseController()
    {
        userId = Guid.Parse(User.Identity.GetUserId());
    }
}

由于Controller未初始化完成,User为空,重写初始化方法,在初始化(ba 阅读全文>>

标签: MVC5 Controller User Null 阅读:4588
2014-1202

做ASP.NET MVC开发的时候,经常会出现一下错误:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specifie 阅读全文>>

标签: SQL Network Interfaces, error: 26 阅读:3623
2014-1202

使用如下代码加载css:

<link href="/Content/css/home?v=zhVOIpUNuvCOZhJyBcQWpMlozayor4te6k-pM29wHqI1" rel="stylesheet"/>


报403 - 禁止访问: 访问被拒绝。
您无权使用所提供的凭据查看此目录或页面。


解决方法:

如上链接MVC Bundle的处理规则是:

如果服务器存在/Content/css目录,则按照常规文件请求文件系 阅读全文>>

标签: ASP.NET MVC BundleStyle BundleScript 403错误 阅读:3569
2014-1021

GET方式的直接使用

$file_contents = file_get_contents('http://localhost/operate.php?act=get_user_list&type=json')


POST方式得用下面的(需要开启PHP curl支持)。

$url = 'http://localhost/operate.php?act=get_user_list&type=json';
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $u 阅读全文>>
                
标签: PHP调用接口GET和POST方法 PHP GET POST 阅读:3397
2014-0925

这里示例是Payment Page方式,即跳转到Firstdata网站进行支付

1.申请帐号,配置相关Payment Page

Receipt Page Setup里边设置Relay Response Url,记着开启Relay Response;这个Url是我们自己网站用来更新订单状态的,源码如下:

<?php
require_once("../../../include/common.inc.php");
require_once("../../../users/config.php");
echo"<h2>";
ec 阅读全文>>
                
标签: Payment Page FirstData 国外支付接口 阅读:3738
2014-0505

The type or namespace name 'Schema' does not exist in the namespace 'System.ComponentModel.DataAnnotations' (are you missing an assembly reference?)


报以上错误,添加EntityFramework.dll引用即可

标签: EntityFramework DataAnnotations 阅读:3613