asp.net-mvc-3

.NET OpenXML performance issues

被刻印的时光 ゝ 提交于 2020-01-31 08:53:10
问题 I am attempting to write out an Excel file from an ASP.NET web server using OpenXML. I have about 2100 records and its taking around 20-30 seconds to do this. Any way I can make it faster? Retrieving the 2100 rows from the db takes a fraction of a second. Not sure why manipulating them in memory would take any longer. Note: ExcelWriter is our custom class, but all its methods are directly from code in this link, http://msdn.microsoft.com/en-us/library/cc861607.aspx public static MemoryStream

.NET OpenXML performance issues

Deadly 提交于 2020-01-31 08:52:46
问题 I am attempting to write out an Excel file from an ASP.NET web server using OpenXML. I have about 2100 records and its taking around 20-30 seconds to do this. Any way I can make it faster? Retrieving the 2100 rows from the db takes a fraction of a second. Not sure why manipulating them in memory would take any longer. Note: ExcelWriter is our custom class, but all its methods are directly from code in this link, http://msdn.microsoft.com/en-us/library/cc861607.aspx public static MemoryStream

.NET OpenXML performance issues

*爱你&永不变心* 提交于 2020-01-31 08:52:05
问题 I am attempting to write out an Excel file from an ASP.NET web server using OpenXML. I have about 2100 records and its taking around 20-30 seconds to do this. Any way I can make it faster? Retrieving the 2100 rows from the db takes a fraction of a second. Not sure why manipulating them in memory would take any longer. Note: ExcelWriter is our custom class, but all its methods are directly from code in this link, http://msdn.microsoft.com/en-us/library/cc861607.aspx public static MemoryStream

404 handling in Azure website

风流意气都作罢 提交于 2020-01-31 04:31:26
问题 I have got an MVC website on Azure. I have written a controller action to stand in for a resource, that should return HTTP 404, but the body content should be some HTML where I explain the reason for the 404. This is implemented as a standard action that sets Response.StatusCode . This works fine locally, but when deployed to Azure, I do not get my custom view, but just an error message in plain text. I have removed <customErrors> on Azure for debugging, with the same result. This is the raw

404 handling in Azure website

人盡茶涼 提交于 2020-01-31 04:30:46
问题 I have got an MVC website on Azure. I have written a controller action to stand in for a resource, that should return HTTP 404, but the body content should be some HTML where I explain the reason for the 404. This is implemented as a standard action that sets Response.StatusCode . This works fine locally, but when deployed to Azure, I do not get my custom view, but just an error message in plain text. I have removed <customErrors> on Azure for debugging, with the same result. This is the raw

Handling file upload from HTML form in ASP.net MVC 3 c#

人盡茶涼 提交于 2020-01-30 11:58:05
问题 I have plenty of experience with this in PHP, but am fairly new to ASP.net. I've found some tutorials around the web which have gotten me this far, but I am currently running into issues. So to summarize what I'm trying to accomplish, I have a page where I want users to submit contest entries. I use a HTML form to collect things like entry title, description, and want to allow them to be able to submit an image representing their entry. When they choose to provide an image, I want it uploaded

Convert string to long type and use in a linq query within asp.net MVC

微笑、不失礼 提交于 2020-01-30 08:29:44
问题 Is it possible within Linq in C#, to convert a string field in a database, to a long type - and use it in the query? Here, tme is a unix time (long) - but the field in the database, targetdate - is a string. I've tried: var qbt = db.Calls .Where(x => x.team == id && long.Parse(x.targetdate) <= tme); However I get the message: LINQ to Entities does not recognize the method 'Int64 Parse(System.String)' method, and this method cannot be translated into a store expression. I know you can convert

Why is this error, 'Sequence contains no elements', happening?

▼魔方 西西 提交于 2020-01-29 04:22:27
问题 I am getting an Invalid Operation Exception, the stack is down below. I think it is because db.Responses.Where(y => y.ResponseId.Equals(item.ResponseId)).First(); is not returning any results. I checked the response data and the userResponseDetails has a ResponseId, I also just used a hard coded value. I also know that the statement that calls this one is adding the Responses row that this function should be calling. (This was working about a month ago and I don't remember changing anything

jQuery File Upload plugin asks me to download the file, what is wrong?

情到浓时终转凉″ 提交于 2020-01-29 03:16:08
问题 I'm using https://github.com/blueimp/jQuery-File-Upload and I was able to upload and save the file to designated folder, and then I return the Json object. Then the browser (I use IE8) pops "File Download" dialog and asks me to download a file named "upload75bea5a4" with no extension. I just could not figure out what is wrong? 回答1: I am using the same plugin and it's working without any problems for me. I will post the codes I am using so that can help you. The C# code I saw at Scott

ASP.NET MVC: Is Controller created for every request?

空扰寡人 提交于 2020-01-26 10:17:28
问题 Very simple question: Are controllers in ASP.NET created for every HTTP request, or are they created at application startup and reused throughout requests? Will the controller be created only for a particular HTTP request? If my previous assumptions are correct, can I depend on it? I want to create database context (Entity Framework) that will live only for one request. If I create it as a property initialized in controller's constructor, is it granted that new instance of context will be