I'm storing my HTML in a database so the page loads the HTML data from the database. I use ViewData in my ASPX page in order to populate the page. The HTML is stored in a NVARCHAR(MAX) column and it's working great for small pages. The problem I'm having is when the开发者_如何学Go HTML is large. It populates 2 thirds of the HTML data but loses the last third. Is there a limit to ViewData?
There is no limit on view data size as far as I am aware of, certainly view data of many megabytes is possible and that should be enough to contain the HTML of even the enormous page.
How much data are you talking about? Are you actually storing the viewdata in the database as part of the page HTML? This feels like a bad idea as the view data of the page should be generated by the asp.net runtime.
Based on the comment "12.0Kb of data." I would assume your problem lies else where.
Check if the data is there before you load it to the view data.
Not sure how you rendering your viewdata. But if you store html file in database table, I am sure you have a column holding FileType. You could implement an actionlink to open an html file using FileContentResult type method. Assuming you have a table name 'HtmlPage', doc and docType as columns.
public FileContentResult GetHtmlFile(int id) { HtmlPage htmlPage = _repository.GetPrepAttachmentByID(attachmentID); return File(htmlPage.doc.ToArray(), htmlPage.docType); }
Hope this helps...
精彩评论