How does jQuery's FileUpload's Backload connect with UploadHandler? - asp.net-mvc-4

I got jQuery File Upload along with Backload up and running in Visual Studio, straight out of NuGet. The demo works just fine, I can upload files. I'm using the default configuration.
http://blueimp.github.io/jQuery-File-Upload/basic.html
https://github.com/blackcity/Backload
BackloadDemo/Index.cshtml has the following form:
<form id="fileupload"
action="/Backload/UploadHandler"
method="POST"
enctype="multipart/form-data">
It works, but I can't figure out how it works. Where does /Backload/UploadHandler link to? I cannot find any reference of this 'UploadHandler'.

I was trying to figure the same thing out and I have found the answer.
If you check the Backload.dll you will see a namespace of Backload.Controllers with a class named BackloadController.
This is the controller that is picking up and handling the request. ASP.Net uses reflection to gather all classes that end with Controller and inherit from Controller. The reason you can't see this controller in the Controllers folder is because they are embedding the implementation inside the Backload.dll

From your second link:
Backload is a professional, full featured file upload controller and handler (server side) for ASP.NET
So the request to /Backload/UploadHandler either gets intercepted by a handler or picked up by a controller.
If your actual question is "How do I incorporate Backload in my project", then refer to their documentation or show relevant code and explain what you did, what you expect to happen and what actually happens.

Related

NopCommerce 3.3 Add link for custom Plugin Action in ProductTemplate.Simple.cshtml, unable to find Controller and model of same view

We had created a Custom Plugin , The Nop.Web Site provided to us by our Client did not had Controller, models, Nop.Web.cs project. Initially We did not require to access much of the Nop.Web project as everything was managed through Plugin
But now there was need to add a custom Link on the ProductTemplate.Simple.cshtml view of Nop.Web/Themes/Motion/View/Catalog
Link was to add the product into a custom registry Cart.
The link access ActionResult from "Catalog" Controller supposed to be in Nop.Web Controller.
I need to pass it our Custom Plugin Controller and Action Result. But it throws error as it cannot find the controller nor "Our Custom Plugin Controller" neither the "Catalog" controller.
Can anyone suggest us solution to achieve this in better way.
Any help will be appreciated.
Can you open your controller action in a separate window? Are you sure it's valid?
Have you looked at widgets which are supported by nopCommerce? This way you won't need to edit the cshtml file

ASP.NET MVC, razor view, how to modify html on the fly like Glimpse?

I'm upgrading from .NET 2.0 to MVC 4. Back in .NET 2.0 webform, we had to inject license information on the fly to the footer of the software by override the "Render" function in .aspx.cs page (using HtmlTextWriter), find a particular spot of the footer and then insert the license text info there.
The reason I don't want to directly put that in the viewstart page or any razor page themselves using HTMLhelper is because I don't want my customers to mess with it. So hard code is not an option.
I use Glimpse and I see Glimpse is enabled by adding a HTTPModule,etc in web.config and magically, an icon appears on my app. Something similar ?
Bottom line is, I need to hijack the finished HTML output, modify it and return the final result to client.
How do you do this in MVC? HttpModule?
Thanks!
Glimpse uses a feature of ASP.NET called a ResponseFilter to change the output HTML on the fly.
The ResponseFilter, in the case of Glimpse, is set inside the HttpModule - but it could be set anywhere.
Four Guys From Rolla has an old but still relevant article on how to create ResonseFilters.

How to add code to SharePoint 2010 master page

I have created custom master page with custom elements included according to this link: http://msdn.microsoft.com/en-us/library/gg447066.aspx
I want to have a Suggestions form in header area where users can leave their comments/suggestions on what functionality they would like to have.
For example:
User goes to company team site and notes that it would be great to have a clock on it
User fills the Suggestions form and the suggestion is emailed to me
Now I decide will I implement/develop it or not
I have placed all html elements and now I need code implementation. My question is: "How to code html elements to achieve desired functionality?".
Tried to follow up through this solution to add code behind masterpage: http://rburgundy.wordpress.com/2010/03/10/sharepoint-2010-custom-masterpage-with-code-behind-file-%E2%80%93-part-2/
but I get an error which I don't know how to handle.
Here is the error:
Parser Error Description: An error occurred during the parsing of a
resource required to service this request. Please review the following
specific parse error details and modify your source file
appropriately. Parser Error Message: Could not load the assembly
'Branding102, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=84d1d0117dd4046d'. Make sure that it is compiled before
accessing the page.
Source Error: Line 1:
I need to implement _starter.cs file as code-behind masterpage.
Don't bother with webparts in your master page.
Delegate control is your friend.
http://msdn.microsoft.com/en-us/library/ff650763.aspx
http://fyeomans.com/2011/05/16/make-your-sharepoint-2010-master-page-extensible-with-delegate-controls/
You can write your delegate control to be full postback or Ajax, implementation is up to you.
Personally, having webparts in masterpage is a no-no for me, that's what page layouts are for. In masterpage, delegate control is THE prefered method to have custom html/code rendering.
http://edwin.vriethoff.net/2007/10/02/how-to-send-an-e-mail-with-attachment-from-sharepoint/
Something like this within a web part and then add a web part to your master page.
Hope this helps

Having codebehind for Custom .aspx page in sandbox solution

I am having working with sandbox solution. i have one .aspx page in my solution and i have placed one button tag in that page, i need to write server side code for that button. But it is showing "The event handler 'OnClick' is not allowed in this page." . Does codebehind is not allowed in sandbox solution. Or indirectly how can i write my c# code for that button.
I know we can do it by creating one webpart and show that webpart in page using "WebPartPages:SPUserCodeWebPart" tag . But i want to confirm whether we can write codebehind for an asp page in some way or not.
Without changing the web.config file (which would not be recommended in this case), inline code or code behind files are not supported outside of the layouts folder (which you cannot deploy to with a sandbox solution).
However, you should be able to create a class and then set the inherits attribute to point to that class, instead of referring to the class in a code behind file.

Rails : Can I use forms from the public/index.html file?

Am currently using Rails 3.0 to develop my app.
How to handle a form in the public/index.html file which I'm planning to use as my Home page.
Usually a view's action buttons gets paired with the corresponding method of its controller.
But how to handle this in case the index file in public directory?
This is possible, so long as the form's action attribute is pointing at an action of a Rails controller. However, it is not the norm in Rails to use a static HTML page to capture data. The norm is to use the MVC architecture of Rails.
I have to ask: Have you read the documentation provided on the Ruby on Rails website? Check out http://edgeguides.rubyonrails.org and read the Getting Started section.
Now, I think you might be using public/index.html because you don't know how to use a controller to serve the root of your website. Here's a quick example of how to use a controller instead of public/index.html:
Create a controller (i.e., home via rails g controller Home index)
Modify routes.rb and add root :to=>"home#index"
Delete public/index.html
The above is actually in the Edge Guides, Getting Stated section. So again, I strongly recommend you read the documentation. It will honestly save you a lot of trouble.