MVC :: Can't Implement FileResult In VS 2010?
Jun 19, 2010
How to reproduce:
1. Start a new class library project in VS 2010
2. Add System.Web and System.Web.Mvc assemblies to the project
3. Implement Class1 as follows:
[Code]....
4. When you try to compile you will get these errors:
error CS0115: 'ClassLibrary1.Class1.WriteFile(System.Web.HttpResponseBase)': no suitable method found to override
error CS0534: 'ClassLibrary1.Class1' does not implement inherited abstract member 'System.Web.Mvc.FileResult.WriteFile(System.Web.HttpResponseBase)'
Notes:
1. This only happens in VS 2010. Works fine in VS 2008.
2. I tried it on two different machines with the same result.
View 1 Replies
Similar Messages:
Sep 8, 2010
I wanted to use the ASP.NET Chart Controls, but since all of the available examples used a code-behind page reminiscent of Web Forms, I shied away from this. Then I found an example returning the Chart Control as a FileResult, and tried it out. It worked, I was happy and all was good in the world. Except that occasionally I'll get a broken link showing instead of the image it should resolve to.
Here's how I have it set up:
In the View, the code is very simple. It's just an image tag that has its src attribute set to the Controller method. I didn't realize this was possible, and thought it pretty cool:
[Code]....
In the Controller, I instantiate and build the Chart Control in its entirety, and then output it as a FileResult:
[Code]....
Yes, it's a bit long and involves, but that's what you get when programmatically building something inititally set up to be a server control. All of this works, and even when I get the output that shows a broken link, if I refresh the page, it generally fixes itself. Here's the code from the FileResult created for this purpose - it's not a Controller, but I placed it in with the Controllers just while testing:
[Code]....
I'm thinking that the reason behind the occasional broken link is related to the DataContext object, not any of the above code. It seems reasonable that if the DataContext doesn't build and return a FileResult quickly enough, perhaps because it's doing too many other things, the broken link would show because no file had been built where it was expected. I've included the code anyway, in case someone can find an issue that would cause the problems I've been encountering. Any advice would be greatly appreciated. I had this working with Flex chart components that I genericized so that they worked with MVC methods, but they were way too slow to complete rendering. It often took 3-7 seconds, which was just too long for a user to wait for their page to load. These Chart Controls are really fast and are a perfect solution - if I can get them to render consistently.
View 8 Replies
Nov 11, 2010
I'm having problems with FileResult returning a file with a specific filename. In the database the filename is just and ID + extension (e.g: 456789.mp3)
This piece of code
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
return File(fs, "application/octet-stream", "myfile.mp3");
Work well in every browser except Webkit browsers (Chrome, Safari). Chrome and Safari receive files as original filename (456789.mp3). When I add headers with
Response.AppendHeader("Content-Disposition", "attachment;filename=myfile.mp3");
Safari receives the file as myfile.mp3attach (notice "attach" appended to the extension?), however Chrome receives this file as myfile.mp3,attach (it appends ",attach" to the extension)
View 3 Replies
Mar 8, 2011
how page update methods are normally done in a web page with multiple sections? I have a few web pages containing several sections. Each section contains different controls/values and can be saved/updated at any point. Can this be done without creating multiple save functions for each "save" button click in each section? Can this be done with one save class that accepts any number of different values?
Also, i have some page values that should insert if it does not exist and update if the value already exist. Currently, i have to check the database to see if the value exist before inserting and updating. Is there a better way of doing this in VS 2010?
View 3 Replies
Oct 18, 2010
I'm trying to implement a media player on my web page using Visual Studio 2010 and it's 'toolkit'.
In the toolbox i right click on general->Choose Item->Com Components and select Windows Media player.
But nothing is happening.
If I right click on the general tab and press 'Show All' both the windows media player accor but the icon are like 'invisible' and you can't drag it into the design window.
A second question, if I want to use a different media player, how does I do that? I.e. VLC...
View 8 Replies
May 18, 2010
I have a clean installation of Windows 7 with VS2010 RTM and am trying to get the ASP.NET Development Server to work. When I run the project, the WebDev server starts and shows that it's listening on port x on localhost. I've tried:telnet to the port. The port is not listening. running netstat -o shows that the WebDev server is in fact not listening on any port. manually changing the WebDev port to a different port and restarted VS without effect. I have Windows Firewall turned off entirely and am not running any other firewall software either.
View 1 Replies
May 20, 2010
I want to convert date from May 20 2010 2:54PM to 2010/5/17
Has anyone does this before.
I want this functionality both in C# and JavaScript.
In javascript I was trying the following
var dte = new Date();
dte = Date.Parse('May 20 2010 2:54PM')
however this was giving me NaN.
let me know if you want to see my code in C#, it isn't working and I think it is broken so am not posting here.
View 2 Replies
Apr 4, 2012
It cant be more simple. However I have tried a lot of examples and none of them have been working.
I have a very simple Excel file. I want to post these data in a gridview, Column A, B and C all placed in the Sheet1 and the file name is Book1.xls.
View 2 Replies
Sep 18, 2011
how to integrate my asp.net application to sharepoint 2010?
View 3 Replies
Nov 11, 2010
How do you convert a text that says Jan 2010 to 01/2010 in asp.net.
View 3 Replies
Jun 5, 2010
how i convert
4/5/2010 4:16:28 into this format 4 May 2010
View 13 Replies
Oct 15, 2010
I have a string "10/15/2010" I want to split this string into 10, 15, 2010 using c#, in VS 2010. i am not sure how to do this.
View 9 Replies
Oct 26, 2010
I've wrote the comprehensive post within my blog: [URL] In brief words everything is simple:
1. I've downloaded free Visual Studio C# 2010 Express and Visual Studio Web Developer 2010 Express
2. I've successfully installed these versions.
3. I've tried registration online - and got the appropriate keys which I've used for registration.
Finally all the keys I've got are not valid for the system - and after 30 days evaluation (for free version?) period all these products are not running anymore because all the keys I am providing from online registration are invalid.
View 2 Replies
May 10, 2010
I have been ising TFS 2010 with VS 2010 Ultimately for a couple of months now. I have a client who is using Visual Web 2010, does anyone know if this integrated with TFS easily?
View 1 Replies
Mar 9, 2011
I am biginner regarding Database in vb.net I have a ms access as db
Field names as follows.. Uname and UPassword, the table is named as accdb and saved as useracc.mdb in 2k3 format... While in my vb.net my main page form has the followings
2 label boxes for Name and Password 2 text boxes namely loginid.text and loginpass.text A button named Login Here are the codes that i am working on
[Code]....
View 14 Replies
Jul 6, 2010
I tried to install Visual Studio Prof 2010 trail version in my system, but i got an error saying 'Please remove/uninstall Visual Studio 2010 load test controller' to proceed installation. i uninstalled my previous VS2008 software from system and i could not find anything like 'Remove/Uninstall Visual Studio 2010 load test controller' software in my Add/Remove Programs.
View 1 Replies
Mar 11, 2011
Can I install Microsoft Visual Studio 2010 Service Pack 1 in Microsoft Visual Web Developer 2010 Express?
View 1 Replies
Jul 15, 2010
I'm thinking about installing vwd 2010 or vs 2010 express but want to know if either offer integrated jquery support.
View 4 Replies
Jun 24, 2010
I want to implement the MVP in my project. I want that when I click a button appear some letters on the textbox.
View 5 Replies
Apr 1, 2011
I have a piece of code which loads either french or english text and 2 link buttons that allow to switch between.
[code]....
What would be an efficient way of displaying the link buttons and text if both English and French exist and the session exists in either EN or FR.
I've thought of using panels to hide the buttons or text, but the main problem is having the page refresh to set the Session variable. Response.redirect(URL) to refresh the page i suppose and i can't find a better way to display the text other than to Response.write it since then i'd need a ton of labels.
View 1 Replies
Jun 5, 2010
I've written a web form application which contains a multiview.. i have a drop down list which selects the view.. On selecting the option in the dropdown list , the content in the view changes... Well can any1 tell me how to implement multiview in asp.net mvc
View 3 Replies
Jul 22, 2010
need to write Cache Methods in my asp.net mvc project.. I created one Class called CacheHelper.cs file.. Mainly In my appliction I am using three types GetData() ( getting data from cache)Add() ( Add data to the Cache) Refresh() ( Refresh data) or Flush()
View 4 Replies
Dec 13, 2010
We have one application, which have to store multiple emails in the msmq and pass to different application...so please tell me how to implementt msmq in .net?
View 1 Replies
Jul 6, 2010
how to implement jqgrid in asp.net
View 2 Replies
Apr 4, 2011
Can I Implement Caching in MVC, If so how? I wanted to implement Cache in Controllers
View 2 Replies