Sub Domain handling in a Node js application - css

I have a node.js application hosted on an AWS instance.
The directory structure is user/app/public. index.js lies within app and the public directory holds css, images, js & scripts as well as static HTML files.
Recently I moved from the existing my_application.com/sites to something like sites.my_application.com. Post performing the relevant changes the web pages worked fine except for one web page which for some reason is still hitting the old URL. Rest all work just fine. It is supposed to be a view web page based on Id.
However the CSS and JavaScript and every request from here onwards keeps hitting the previous URL & hence instead of site.my_application/view/id I get my_application/site/view/undefined. Any help on this would be much appreciated!

Related

ASP.NET site not updating after changes

So, I have a pretty basic ASP.NET site that was built and published via ftp through VS. Original publication went fine, as did the first few updates. But now I've made page changes (css as well as in the aspx files) and they don't seem to get pushed to the server. I believe that my code behind (C#) files are being updated since there are a few visual elements I call in the code. When I look at the ASPX files, they have old dates and the code is the prior version. VS says the publishing succeeded, and the host (GoDaddy) says there's no caching or quota issues on their side. If I upload a new dummy page it goes through... so it looks like updated pages are the issue.
What am I missing?
If it's styles have you tried doing a hard-refresh on your browser? If everything is saying the files are updated then maybe you have a locally cached version.

Having Issues with setting up site/start page with Angular HelloWorld project in VS 2017

I know the VS Code is the tool most seen in Angular demos and I've tried them but I was going through a YouTube demo on using Visual Studio to develop a Hello World Angular app.I started out using NPM START to run the app then was following the instructions here to use the Visual Studio Start button to initiate the app.
The app was sometimes rerunning and sometimes not. I was thinking it had something to do with the startup folder but now I wish that I would have modified by startup page instead.
Here's what my folder structure looks like:
Anyways, I first I started messing with the application root URL. I tried changing it from
http://localhost:61539
to
http://localhost:61539/src
and some other values too. I confirmed that i wanted to create a virtual folder and played around entering multiple values. As a result, I noticed that my IISExpress icon in the tray started to show all of the URLS that I had entered
I wanted to try an undo these virtual folders that I created but I didn't know where they were stored. Finally, I saw that the last path that I specify is stored in the VS Project file but I don't know where all of the other sites are stored. I'd like to delete them. Is there some IIS Express config file?
The whole problem started when I was trying to get the initial the web page to come up and I was getting a "Forbidden" error. Now I think that it could possible be solve by setting my initial page to src/index.html, although the YouTube video didn't mention it.
Now, every time I hit the start button to run the web app, the following URL is displayed with an extra trailing slash after the html page name.
http://localhost:61539/src/index.html/
and I still get the forbidden error.
Question
So, how do I clean up my IIS Sites that I don't need and set my startup params so that the web page comes up and displays index.html?

add new page to existing website without modifying the rest of the website

i have to add one page to an existing asp.net webforms website.
this will be added at runtime and i'm not allowed to redeploy the entire webapplication / website.
is the (recommended or only) solution to move the code behind code to the aspx file, or do i have other options?
i can't put code in the dll's, and dynamicly runned .cs files are only in the case of a website and not in the case of a webapplication, am i right?
and putting the code from my code behind in de aspx file will always work?
actually as long as their page link to yours via URL you web page doesn't necessary have to be in the same project, unless you're trying to reuse something.
Else technically your project is fine as a standalone and they can just link to yours.
Unless you're worried about the URL then you would have to either use an iframe or some other URL rewrite.
Just for reference: One solution would be to use a dynamic proxy and intercept and extend the existing webapp. Though this approach might be a little too involved for what you're trying to achieve.
LinFu
Castle

Relative Links with Extension-less URLs

I have an ASP.NET 4.0 application that implements URL routing. This gives me page URLs with no extension (e.g. /Articles/{title})
Some of these pages contain relative links. When I test the site from Visual Studio, relative links point to /Articles/{title}/mylink. However, when I deploy my site to a shared hosting account, the same relative link points to /Articles/mylink.
You can see the problem at http://blackbeltcoder.com/Articles/asp/creating-website-thumbnails-in-asp-net. The link to an image near the top is broken. This page worked fine when testing from Visual Studio. {title} was assumed to be a directory. But, once deployed, {title} is assumed to be the page name.
If I append "/" to the URL above, it works as expected. But how can I make sure it always works?
Can anyone help me understand this?
After extensive tests with both this website and another one that also uses URL routing, I'm finally able to define what is happening.
I'm going to describe the way this site behaves on the hosting account as "normal". It's the same way my other site works on both the hosting account AND when run on my desktop. (Although the other site doesn't use relative links this way.)
The odd case out is when I run the new site on my desktop. The browser automatically appends "/" to my routed URLs, as though they are directories.
And the reason it does this is because I have created physical directories with the same names! If I delete the physical directory, it treats the URL as a reference to a file.
So the main problem for me is that I developed the site while testing with this odd case. Therefore, the solution is either A) make sure "/" is appended to all these links so they are considered directories, or B) alter the directory structure I've designed.

If my ASP.NET webapp isn't fit for runtime?

I want to run some tests when my ASP.NET webapp comes online (preferably before anyone tries to access it), to make sure all of my runtime dependencies are available as I expect them to be.
When is a good time to perform these tests (e.g. Application_Start, Application_Init, somewhere else, etc), and what's a good technique for making my webapp unavailable to users if my tests fail (it shares an app pool with other apps I don't want to affect)?
One approach would be to put your checks in the Application_Start event, and update a static property (or properties) in the Global class with the result of your test.
If you're using master pages, each master page (I've personally never seen more than 2 base master classes in a project) could check the static property in the Global class, and redirect to an "app offline" page if appropriate. Since the static property would only be updated when the application started, there shouldn't be any performance impact.
The code in your master page's OnLoad event might look like this...
if (!Global.WasDependencyCheckSuccessful)
{
//redirect to error page
}
If you're not using master pages, this may not be the best solution (because you would need to update each web form in your site individually).
You can put it in the Application_Start event in the global.asax.
To bring your app offline, simply create an App_Offline.htm file. I do it on our server by having an "App_Offline.html" file and when I need to bring it offline, I have the code rename it to change the extension from .html to .htm, and reverse that to bring it back online.
Of course, to bring it back online, you have to do it from code outside of your website, or do it manually, because if the file is there, the code in your website won't run...

Resources