我试图在我的MVC3网站上做这样的文章.但是,我不确定我可以在我的Action中使用Response.End.
我的问题是,如果HttpContext.User == null,如何从我的Action返回401状态代码?
public ActionResult WinUserLogOn(string returnUrl) {
var userName = string.Empty;
if (HttpContext.User == null) {
//This will force the client's browser to provide credentials
Response.StatusCode = 401;
Response.StatusDescription = "Unauthorized";
Response.End();
return View("LogOn"); //<== ????
}
else {
//Attempt to Log this user against Forms Authentication
}
Run Code Online (Sandbox Code Playgroud) 我是linux编程的新手.我写了一个非常简单的程序:
#include stdio.h
#include fcntl.h
#include sys/ioctl.h
#include mtd/mtd-user.h
#include errno.h
int main( void )
{
int fd;
fd = open("test.target", O_RDWR);
printf("var fd = %d\n", fd);
close(fd);
perror("perror output:");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
test.target只使用touch命令创建.该程序的输出是:
var fd = 3
perror output:: Success
Run Code Online (Sandbox Code Playgroud)
我试图打开其他文件,文件描述符总是3.我记得它的值应该是一个更大的数字.如果这个程序有一些错误?
我试图在foreach循环中将数据存储在如下的数组中:
名字,姓氏,出生日期
因此,一旦循环完成,我应该得到{John,Smith,05/05/1980},{Mary,Smith,05/04/1980} etc...这将使我能够访问存储在系统中的每个人的不同信息.
最好的方法是什么?我一直在阅读使用这里显示的分层数组http://msdn.microsoft.com/en-us/library/ms486189(v=office.12).aspx但我不确定这是否是最好的方法.
我是c#编程的新手,所以任何建议都会非常感激!
我想知道以下表达式的含义是什么:
unsigned char *buff_p = txBuffer, hdrFlags, msgType;
Run Code Online (Sandbox Code Playgroud)