I Have asp application in net framework 3.5. Views are build with Vuejs.
I like send fetch request with object serialized to form data and i dont know how to read this.
This is the codebehind method
Thanks.
Related
I have a big website/application coded in Classic ASP, ASP.NET and ASP.NET MVC.
I have a menu on top with a lot of HTML CSS JS, and some conifiguration (visible or not ...)
and lot of dynamic links.
So the problem is when i have to update the menu i have to update 3 files, one Include in Classic ASP, one ASCX user control in asp.net and one Partial view in asp.NET MVC
I hate code duplication, so is it possible to use only one component ?
I heared about Com but i have no idea where to start.
Thanks for help
Edit : I am thinking know to use a .net Object, that can generate a string containing all the html that i need and then put it in the views MVC and in the asp.net pages
But how to use it in Classic ASP?
There's nothing stopping you using a webapi controller to expose this functionality; the webapi controller would return json or xml menu structure to the client browser this in turn would be rendered using by injection of the json over into the browser DOM and styled using CSS.
Classic ASP and MVC ASP.NET would use the same javascript and css.
I'm also working in a legacy application that is very much similar to your case, how bad the life is :(
I'll go for XML/XSLT in your case.
I'll create an XML file that contains all the menu details and use XSLT to generate HTML from XML. I can easily use the XML and XSLT in all the three technologies. So every time you need a change you have to change either the XML or XSLT file.
You can even create a simple .NET component that uses the XML/XSLT approach which could be easily used in ASP.NET Web Forms, ASP.NET MVC (in custom view engine?) and in classic asp as well (you have to register).
Guess, you can make an action method in asp.net MVC to render the dynamic menu and do AJAX load from the javascript in every part of the site?
UPDATE:
You can make an HTTP GET request in classic ASP to the aforementioned ASP.NET MVC handler, and cache results if its not very dynamic. Anyway it should be pretty fast if its within the same server. I suppose, request will look like in this answer
I am new to mvc asp.net,I have already one application created in asp.net 4.0,
but i want to convert that exixting application to asp.net mvc architecture.
In my application every page is having some server control e.g. button, but i am not able to invoke the function associated with the button or server controls.
so, please guide me that how i will proceed so that i can convert my exixting application to mvc architecture.
ASP.NET Web Forms (including pages and server controls) rely on infrastructure provided by ASP.NET page and post-back model. On post-back, the control tree is re-build and state is restored using view-state and then control handles the post-back data to raise events.
ASP.NET MVC does not rely on post-back/view-state rather requests (GET/POST) are routed to appropriate controller actions (along with parameter mapping). The controller methods process the request and sends the response by rendering the view. View's function is just to accept the data passed by controller and generate corresponding HTML. Now ASP.NET webform (page) can be used as a view but there would be no post-back and no server control events. In ASP.NET MVC, a button click would POST appropriate form to some controller action.
You need to first understand & learn ASP.NET MVC before contemplating the migration.
Further, IMO, there is no point in migrating the application unless it has long shelf life and you foresee a frequent enhancement/maintenance requests in future.
I'm currently battling to retrieve an image from SQL Server 2008 R2 in an asp web application using vb.net. The image is stored in the SQL Server 2008 R2 database as an image type. I've been researching for the past few days and can't seem to find anything solid on this topic. Apparently, the image has to be retrieved using a http handler, and then then image control's imageurl property needs to reference that?
What kind of item needs to be added to the project for this .ashx page?
Please can someone post me some code for both the http handler and the aspx page using vb.net.
Thanks in advance
You don't have to use a HTTP handler - there are other ways to do this. But using an HTTP handler is an elegant and quite nice way to achieve this.
Read these resources - they should you step-by-step how to achieve this:
Serving Dynamic Content with HTTP Handlers
Displaying images in ASP.NET using HTTP handlers
I am using StructureMap with ASP.NET MVC. I have a requirement where I need to show a ReportViewer and for that I am using a classic ASP.NET page. The problem is when I am trying to redirect from the action I am getting following issue:
The IControllerFactory 'StructureMapControllerFactory' did not return a controller for the name 'Reports.aspx'.
Can someone please guide me on how do I call a classic asp.net page from an action and get rid of this error?
You need to map a route for your classic page so that the MVC engine skips it.
If you are looking to redirect the request to a 'classic' ASP.NET web form from the controller action, you might call HttpContext.Response.Redirect("URL"). The routing engine by default will resolve files that exist on the disk. No need to map new routes.
Is it possible to do Web form without using server control or set runat attribute on html control? How do you call the code behind function?
You can't call codebehind functions without a runat="server" tag at a minimum. If you created a Web Service instead, you could create a pure html/javascript page that interacted with the server through AJAX. These are your only two options to use ASP.Net as far as I know.
Yes, it is possible to do this. The form with runat server is only needed if you use postbacks and server controls.
If you do not use server controls you should be able to add forms to the page that POST to other pages (it can even post to itself). In your page_load you will be restricted to using the normal request.form and request.querystring to retrieve form values, but you should be able to call other methods on the page.
If you are familiar with classic ASP, you can do the same thing with asp.net.
Also, take a look at the asp.net MVC framework (http://www.asp.net/mvc). It allows you to use asp.net without using webforms.
You can use a HTTPHandler for barebones ASP.NET.
You won't have a markup file, you'll just have a class that runs and exposes you to HttpContext for writing out to the HTTP stream.
http://msdn.microsoft.com/en-us/library/f3ff8w4a(VS.71).aspx
In fact, HttpHandlers are the building blocks of all .NET web frameworks.