MVC :: Return A Script File In 3?
Nov 13, 2010How to return a script file in MVC3?
This is not working.
Function Index() As ActionResult
Return JavaScriptResult(Url.Content("~/scripts/testing.js"))
End Function
How to return a script file in MVC3?
This is not working.
Function Index() As ActionResult
Return JavaScriptResult(Url.Content("~/scripts/testing.js"))
End Function
I've build a MP4Handler. The Mp4 hander selects a correct file from a url.The system works if you work with 'normal' mp4 files.But the problem is the MP4 files are genrated by another program, so i think there's the problem.Right now i returned a test file, then it woks great!Do i return the other file, i get a 412 error if i use it in IE (he shows a 400 error because i deleted the 412 error in the IIS i thought maybe that solves the problem). In IE it doesn't work, but in firefox it works great!In my Fiddler result, the first movie (guid url) is from firefox, and works great. The second with the text/html result (selected row) is from IIS.How can i solve this problem?Or is this the problem?:This entity tag is not recognized by IIS. It only affects version 7.0 of the IIS software.From: http://www.pc-library.com/errors/error-code/412-0x19C/ As coding i use this as base: http://dotnetslackers.com/articles/aspnet/Range-Specific-Requests-in-ASP-NET.aspx I changed The GetRequestedFileInfo with:
public override FileInfo GetRequestedFileInfo(HttpContext context)
{
return new FileInfo(context.Request.PhysicalPath);
}
Possible Duplicate: How to create file and return it via FileResult in ASP.NET MVC?
ASP.NET MVC2: How to return a file from a controller? I want to do this so the user can download the file from server.
I've a problem while using ASP.
My situation is I want to convert every documents' contained words into database and upload those document to server.
For example: MS word, MS Power Point, MS Front Page and PDF files.
Those words needed to store into database and let others to search by content.
I have a VS 2008 web application that I need to capture the full file path (directories and file name) from the selected file. So user selects a file and then clicks on one of the buttons which transfers control to my code for processing. So how do I get the file path? I can get the file name, but not the path.
View 2 RepliesThere is a lot of discussion about todays fix for ASP.NET to prevent an attack that can be used to get the encryption keys from an application. In one discussion I read that it could also be used to make the WebResource.axd handler return any file in the application by forging the request parameters to point to a known file location (where /web.config would be the most obvious choice).
View 1 RepliesI have three XML files that are auto-generated and placed into my wwwroot directory. From there, I need to be able to search through these XML files looking for a record by either first name or last name. So, I have three xml files: a_results.xml, b_results.xml, and c_results.xml.
I'm having trouble reading / scanning these files so I really need some hand holding here. Very novice ASP/asp.net programmer here. Basically, I want a "search page" where the user will enter their search criteria into a text box (either first or last name) and the page will search the first and last name fields in all three of my xml files and return the results in a table, including the resulting first and last names plus their extension number.here is an example of one of the xml files
Code:
<response method="switchvox.extensions.search">
<result>
<extensions page_number="1" total_pages="1" items_per_page="500" total_items="3">
<extension number="1111" status="1" can_dial_from_ivr="1" account_id="1446" display="John Smith" date_created="2009-12-23 11:57:36" type="sip"
[code]....
So, as an example... I go to the page - enter "test" into the search box and click "find". The page should search all three xml files for the word "test" in the first OR last name fields and then return ALL of the combined results in a table which shows first name, last name, location and extension number (all available in the XML file(s) as shown above).
I'm integrating jquery fullcalendar into my application.
Here is the code i'm using:
in index.aspx:
[Code].....
I'm having a very hard time wrapping my head around this problem (it might be the heat from the summer finally arriving).
Problem:
I want the user to press a button client side which performs javascript data preparing and at last send a JSON structure to (currently a asmx webservice on) the server. The JSON structure is several levels deep.
Server side I create a PDF file which I want to send back to the user.
Goal:
The user feeling is that she presses a button and expects a PDF to return to her - either in a new window or as a download (preferrable).
Tools:
The system consists of (client side) HTML, JavaScript and ExtJS and (server side) ASP.NET.
Normally I would use an ashx handler to return a file to the client, but can I send a JSON structure to the handler and still be able to parse it correctly server side?
I am searching for the pattern to use.
I'm using ASP.MVC 3 with SSRS 2008 R2. I have some reports which I want to render as PDF document. So I my controller, I've got this code
[Code]....
Problem is, that this code returns empty pdf. If I call PrintReport directly from view, then it works. But when I call ReportSwitcher, which calls PrintReport, then it returns empty file.
Got a problem with regards to the file upload control on database updates. The problem is in my CMS, when a user tries to update content for a page it will add null to the fields containing the image path. What I need is for the system to check if the uploader has no image and if hasn't it has to do nothing. It can't add empty strings or null values as this will remove the original image path. Although they still need to be able to do image updates if the uploader has a file(this bits not a problem).
Here is a snipet of code to demonstrate what I'm trying to achieve.
[Code]....
I am calling a file download action from javascript:
$elem.click(function() {
window.location.href = 'MyController/MyFileDownloadAction';
});
The controller returns a file:
[code]...
This action has a pretty high likelyhood of throwing an exception (or at least not being able to return the file).
Due to the nature of the application (which contains a lot of dynamic content), I can't really redirect to an error page in this situation. The current page needs to stay open somehow.
So I'm ideally looking for something like a javascript pop-up, but afaik this isn't going to be possible since I don't know any way to return a javacript instruction in a non-ajaxed controller call. If I display an error page I need to force it to open in a new window some how. Is there any possible solution to this problem?
I have a problem that currently we are use a sybase database and we want to create application that give me a output in excel report that's mean my data stored at sybase or mysql and we access it from this after it generate my report in excel form and give this output on excel format?
View 1 RepliesI have an update function in my data layer which is defined as:
public int UpdateRBTable(parameters ...) This calls a SQL Server Stored Procedure to perform an update function on the database.
The process does its job for updating the table. However, the stored procedure has a return value (which indicates how many rows were updated), but this return value is not returned to the application. The application always shows that a zero was returned from the stored procedure.
Can my WebMethod return an XmlDocument as return type?
When I try to consume the web service I'm still not getting XML. It appears as though a reference to the method is being returned rather than say a string containing XML.
<WebMethod()> _
Public Function CustomerSearch(ByVal lastName As String, ByVal firstName As String, ByVal companyName As String, ByVal city As String, ByVal state As String, ByVal email As String) As XmlDocument
' Create XML doc
Dim doc As XmlDocument = New XmlDocument()
' some more code
Return doc
End Function
how can i return 401 error from a method return ActionResult?
View 1 RepliesHow can I assign a value to the methods return var BEFORE I return the final value?
Example:
public string Example()
{
[here I want to assign a value to the return var and continue this block until the end] = "TempStr"; [code].....
I have a cascading dropdown. After the dropdown is populated(it is in another file) i would like to return back to the original form where the control is placed. is there anyway of doing it
View 4 RepliesI'm using vs2010, Framework4 and the related AjaxControlToolkit v4.0.30210
Other controls works great such as the html editor, but the AsyncFileUpload return always "The file attached is invalid."
I have a service which reads an image stored in the database. I want to be able to read an image stored on the file system and return that back to the requestor.
View 4 RepliesHow to get asp.net return drop down list to return value as int
I want to pass the value to a stored procedure as an integer. But the default appears to be as a string which is not what the store procedure is expecting.
Is there a good way to return the list values as ints?
I suspect I can you set the value on the change selection event, is there another way?
i have a question about web service and the method that can i use to return the results in xml format. MY SCENARIO IS THE FOLLOW: I have 2 projects: the first is my aspx site and the seconds is my web service. The web service make query to sql database and generate xml file contains the results, and it stored on the webservice's server. My client call web service, that generate xml file, and after my client read the xml file stored to server (by xml reader) and view the results.... Is it correct? For me no. i think that when i call my web service, exist a method that it return xml file instantly, like a stream or like a query. is it true? (i don't know) But the problem is that i don't know how soap works and i don't found any code example.
View 2 RepliesI have an approve button.on clicking on this button it should show that an inactive value is present .Onclicking yes conformation it should save the data or else clicking on no conformation should return false; how i will do that?After alert it always submit the data.Â
protected void ibtApprove_Click(object sender, ImageClickEventArgs e)
{
string otherAffiliateName = txtRequestedAffiliate.Text;
int inActiveAffiliates = new BLRating().InActiveAAffiliateChecking(otherAffiliateName);
if (inActiveAffiliates > 0)
[code]...
This is the code i used.how i wiil stay back on Confirm 'no' click?
I would like ask you for some ideas how can I write mechanism that will be automatically read files from folder. I don't know how to schedule the write task. I want to check for new file everyday and if the new file is in the folder read it.
View 2 RepliesI have an asp.net panel having various controls including gridview. I have converted this panel into pdf and attached it as an email attachment using memory stream. Everything is working fine. Now I have an File upload control outside panel through which I have to attach a file and send it in mail along with the already attached panel. But I am unable to figure out how to do it.
View 1 Replies