Problem:
We have a website written in ASP.NET hosted on an IIS server.
We want to start developing a new website using Java, Springboot, and AngularJS and want to deploy on a web server on the same machine (most probable apache tomcat).
For certain DOM elements on the ASP.NET website, after clicking on them I should be routed to the appropriate web page on the new website hosted on the tomcat.
How can we achieve this communication between these two websites?
If your DOM element is a link (the HTML anchor tag) you can just put the new website page's link as the href property and will just work. You can pass parameters in the query string.
If you are trying to submit a form on the ASP.net page to an end point on Tomcat, then use the Tomcat endpoint as the action property of form. Here you have an option of choosing GET/POST as the method.
If you are tyring to do Ajax requests from the ASP.net page to a Tomcat endpoint, you will get into a CORS issue. There are plenty of articles/tutorials on how to add a CORS header on Tomcat-SpringBoot that will help you out.
Related
I'm supporting an existing product. It was developed with ASP.NET. The entire product has two parts
Main Website - The main website where the user perform activities
Subscriber module - It is a separate website. Another windows application can post XML to the website and this website will save the data to the database. So it purpose is to transfer data between windows application and the main website. This website has one URL exposed to post the data. This one has only one ashx file and the functionalities are implemented using HTTP modules of ASP>NET
My question is subscriber module doesn't have any asmx file or WCF implementation. However any one who has the URL can post XML to this website. So is it correct to call it as web service or API(not technically but semantically)? Or is it a simple website with some special functionality?
An ASHX file is a webpage that is part of an ASP.NET web server application.
Ashx files are used for handling Http Requests and modifying Http Responses;
It contains references to other pages hosted on the web server that are sent to the user's web browser. ASHX files are processed by the server's ASP.NET HTTP Handler when a client web browser requests the page.
Main Website - Its a Web Application
Windows Application - Posting data to server
A web service is any piece of software that makes itself available over the internet and uses a standardized XML messaging system. The function of your subscriber module implements is to post XML to website, it is in line with the characteristics of web service applications.
I am using basic asp.net web application project template, because I want to move away from MVC into SPA.
Most of my pages will just be basic html files that will interact with the server through ajax calls. That said I want to hide the .html extension, but I don't want to create controllers just to hide this, which is too much of an overkill.
Of another note, I am using Azure as well, so setting this up on IIS directly is not going to work, as I would not be able to scale the administration nicely.
So how can I hide the html extensions without such a heavy layer as an MVC controller?
This sounds like a job for Url Routing
Url Routing allows you to intercept a request and then determine how to service it. It is how MVC does it and has many other useful benefits. If the router isn't able to service it, it falls back to the default ASP.NET pipeline processing, and then IIS.
I need to implement the sub domains in asp.net web forms (not MVC) for all clients on fly.
Here is the whole scenario I have a General website for every one as http://mydomain.com
and once a client is registered to my website, he will be allocated a subdomain as
client1.mydomain.com
client2.mydomain.com
client3.mydomain.com
and all clients will be served from
http://mydomain.com/clientwebsite/
with their customized contents from DB server On the Client website.
I looked about it and came to know that it can be done by IIS URL re Write but we will have multiple links and options on client sites which postbacks with querystring and data. I dont know how to send that and rewrite on backend. it can be
client1.mydomain.com/mystoreitems
or
client1.mydomain.com/section=mystoreitems
Kindly guide me how to do this.
I have an Asp.Net 4.0 Web Forms project that uses url routing for user friendly urls, i.e hiding aspx-pages behind clear text urls.
In this project we have an asmx web service that serves some jQuery controls on the pages. Everything has worked fine so far on development machines and the internal testing site but now when we installed the project on a production site the asmx calls are trapped by the routing code.
We have a catch all route that is added last that shows the Not found -page.
When I open the web service on the server (http://localhost/service.asmx?op=MyWebMethod), enter some values and click Invoke I get the Not found page. The url that Invoke opens is http://localhost/service.asmx/MyWebMethod so it's all quite logical (service.asmx looks like a directory) but I don't understand how this can work on all other installations of the same project.
The production server is Windows 2008 Server R2 Standard, the project is Asp.net 4.0 and I haven't registered any StopRoutingHandler for asmx-files.
The web.config files are identical between the internal testing site and the production site and the machine.config -files haven't been touched to my knowledge.
routes.Add(new Route("{resource}.asmx/{*pathInfo}", new StopRoutingHandler()));
Today we tried to put an ASP.NET application I helped to develop on yet another production machine. But this time we got a very weird error.
First of all, from all the ASP.NET pages, only Login.aspx was working. The rest just show a blank screen when they should have redirected to Login.aspx. The HTTP response is 200, but no content.
Even worse - when I try to enter the address of some inexistent ASPX page, I also get HTTP 200! Or, when I enter gibberish in some existing ASPX page code (which should have been accessible without login) I also get HTTP 200.
If I enter the name of some inexistent resource (like asdasd.jpg), I get the expected 404.
The redirect to login page is written manually in Global.asax. That's because the application has to use some alternate methods of authentication as well, so I can't just use Forms Authentication. I would suspect that Global.asax is failing, if not for the working Login page.
Noteworthy facts are also that this machine is both a Domain Controller and has SharePoint installed on it. Although the website in question is listed in SharePoint's exception list.
I would check the following:
Is the application within a virtual application or its own site and not just a virtual directory?
Does the application have it's own App Pool? If it does not then is the app pool shared by apps in a different .net version.
Is the .net version of the application the correct one? 1.1 or 2.0?
Do the files in the file system have the correct permissions to be accessed via IIS?
Have you performed an IIS Reset?
Create a stand alone test.aspx page within your folder that just displays the date/time and check it works.
Make this single test.aspx page perform an exception (eg. divide by zero) and see what the outcome is.
More information required.
What Op Sys?
What mode IIS running under?
What version of .Net?
What version of SharePoint?
(Why are you using your DC as a web host?)
Does it work on the other production machines you've deployed to?
If so what is different between this machine and the working ones?
Did you deploy the same way?
Are you sure your hitting the right machine?
Are you sure your hitting the right web site?
What ISAPI components are installed globally and for the web site?
Is .aspx mapped to the ASP.Net ISAPI filter?
Do you have any HTTP Modules or HTTP Handlers configured?
Can you change the global aspx to write out some messages so you can be sure the piece of code you interested in is reaching?
Anything coming up on the IIS log or the event logs?
Addition:
What version of .Net?
By the sounds of it the .jpg request is being dealt with by IIS directly which is why you get the 404, but the .aspx request is being dealt with by something else which except for you login page, is always returning 200.
Assuming .aspx is wired correctly to .Net the the order of processing is based on ISAPI filters (high to low then global before site), then the ASP.Net ISAPI Extension (sorry I said this was a filter earlier but it's actually an extension). Then we get into the ASP.Net pipeline based on your .Net configs, and calls the HTTP Application (which includes your global.asax code), any HTTP Modules followed finally by a HTTP Handler. Your ASP.Net web forms are just fancy HTTP Handlers.
However, the request can be responded to and terminated from any point.
Since your code works on other machines though, I'm tempted to point a finger at SharePoint if it isn't installed on the working machines. Is this SharePoint 2007? That is also an ASP.Net application (I don't think 2003 was).