我有一个MVC项目,将向用户显示一些文档.这些文件当前存储在Azure blob存储中.
目前,从以下控制器操作中检索文档:
[GET("{zipCode}/{loanNumber}/{classification}/{fileName}")]
public ActionResult GetDocument(string zipCode, string loanNumber, string classification, string fileName)
{
// get byte array from blob storage
byte[] doc = _docService.GetDocument(zipCode, loanNumber, classification, fileName);
string mimeType = "application/octet-stream";
return File(doc, mimeType, fileName);
}
Run Code Online (Sandbox Code Playgroud)
现在,当用户点击如下链接时:
<a target="_blank" href="http://...controller//GetDocument?zipCode=84016&loanNumber=12345678classification=document&fileName=importantfile.pdf
Run Code Online (Sandbox Code Playgroud)
然后,该文件将下载到其浏览器的下载文件夹中.我想要发生的事情(我认为是默认行为)是文件只是在浏览器中显示.
我已经尝试更改mimetype并将返回类型更改为FileResult而不是ActionResult,两者都无济于事.
如何在浏览器中显示文件而不是下载?
使用我们的Windows Azure App时,我们目前遇到以下错误(来自日志):
System.Runtime.Serialization.SerializationException Assembly 'EntityFrameworkDynamicProxies-Marriott.emergePortal.Common,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not found.
Run Code Online (Sandbox Code Playgroud)
这个错误来来去去,我们无法准确理解是什么导致它.
我们已经尝试了一切!任何人都可以提供的任何帮助都会很棒.
日志中的完整错误消息是:
System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Runtime.Serialization.SerializatioFnException: Assembly 'EntityFrameworkDynamicProxies-Marriott.emergePortal.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not found.
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadArrayOfPropertyEnrollmentFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )
at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadArrayOfPropertyEnrollmentFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] ) …Run Code Online (Sandbox Code Playgroud) 我知道这可能是一个非常简单的问题,但我今天在一个项目的代码中遇到了这个问题.return语句如何工作?这是什么操作?它类似于第三级运营商吗?
变量访问是一个int.
return access != IACL.RS_NOACCESS && documentVersion >= 0;
Run Code Online (Sandbox Code Playgroud) 我正在重构JavaScript应用程序以使用Require.js.到目前为止,我有这么好的概念性斗争.
在模块中,创建了许多新对象:
new Dealer(self.c, self.config, "Dealership", "2333 South Loop West, Houston, TX 77054", 6.07, "(713) 558-8100", "9am - 9pm", 0, "http://mikecalverttoyota.com/"),
new Dealer(self.c, self.config, "Dealership", "9400 Southwest Freeway, Houston, TX 77074", 8.89, "(713) 270-3900", "8:30am - 9pm", 1, "http://www.sterlingmccalltoyota.com/")
Run Code Online (Sandbox Code Playgroud)
现在,这些创建得很好 - 另一个文件,dealer.js具有对象定义:
function Dealer(c, config, name, address, distance, phone, hours, index, url) {
var self = this;
self.c = c;
self.config = config;
...
}
Run Code Online (Sandbox Code Playgroud)
从概念上讲,如何将Dealer对象转换为require.js模块,以便我可以在其他模块中使用它,然后在这些模块中实例化它的副本?