DNN Sitemap broken, 404 error - dotnetnuke

I have an issue with a DNN (DotNetNuke) 07.04.01 site that has no sitemap when I visit domain/sitemap.aspx. This may have been caused by somebody creating a page called sitemap which I have since removed but now the website is giving me a 404 response instead of a generated XML file. When I looked into the /Portals/0/ folder there was no sitemap folder or file.
The coreSitemapProvider is visible and enabled when I go to the search engine sitemap page of the website. I have tried disabling and enabling this then clearing the cache and restarting the application but this has had no effect.

I found the cause of this issue. For some reason the website was missing a handler mapping for the sitemap. I added this back in through the web.config file as so:
<system.webServer>
<handlers>
<add name="SitemapHandler" path="Sitemap.aspx" verb="*" type="DotNetNuke.Services.Sitemap.SitemapHandler, DotNetNuke" preCondition="integratedMode" />
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add path="Sitemap.aspx" verb="*" type="DotNetNuke.Services.Sitemap.SitemapHandler, DotNetNuke" />
</httpHandlers>
</system.web>

Did you empty the recycle bin after deleting the page?

Related

React JS App Routing Issue Only After Deploying to Azure Web App

I have a React JS app, with React Router.During development, npm start, I get no issues. I visit the following location as usual.
http://localhost:3000
and due to the routing code, it becomes
http://localhost:3000/index
and the app loads just fine. At this point,
I hit reload, the app continues to run fine.
I manual link or load 'http://localhost:3000/index', the app runs fine.
Then, later, I do an npm build, go inside this build folder, and do an npm start, again, the same thing. the app runs just fine. I reload, it runs fine. Nothing to complain so far.
Problem Portion.
I then decided to deploy the app to an azure web app. The app runs fine. I go to this site.
https://randomstuffreactjsappsept24.azurewebsites.net
and due, to routing code, it becomes
https://randomstuffreactjsappsept24.azurewebsites.net/index
And, the website loads.
At this point, if I hit reload (problem!!), it will try to reload,
https://randomstuffreactjsappsept24.azurewebsites.net/index
I get the following error.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Now, at this point, if I remove the '/index' and load the original url,
https://randomstuffreactjsappsept24.azurewebsites.net
The site loads just fine, no problem. Note, you can see it for yourself. this is a live site. (but of course, due to routing code, it becomes)
https://randomstuffreactjsappsept24.azurewebsites.net/index
Now, as long as I dont reload the website, the website continues to run. Why is this happening?
Here is the code for the main index.js page from the project.
ReactDOM.render(
<BrowserRouter>
<Switch>
<Route path="/index" render={(props) => <Index {...props} />} />
<Redirect to="/index" />
</Switch>
</BrowserRouter>,
document.getElementById("root")
);
The full app is available here - https://github.com/Jay-study-nildana/RandomStuffReactJSApp
Update 2
I decided to try another react app, created by another source entirely. Once again, same issue, and I have a live site to show.
I visit, https://auth0tokenreactjsappprivatesept25.azurewebsites.net/external-api, from within the web app, it works fine. If i were to reload at this point, it will say "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
I visit, http://localhost:3000/external-api, from within the app, it works fine. AND, If I were to reload, it loads just fine.
So, its definitely "only" happening after deployment.
According to: https://github.com/react-boilerplate/react-boilerplate/issues/1612
You would have to place the:
Simply place the following file called web.config under your wwwroot folder:
<?xml version="1.0"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="React Routes" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> </conditions> <action type="Rewrite" url="/" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Add the web.config file to the azure directory
I came accross this issue yesterday after using a custom build in my azure web app deployment (skipped it using skip_app_build = false and build it in a previous job).
My error was that my staticwebapp.config.json file was not located in the public folder -> it was not deployed correctly. after inserting any route a 404 was thrown by azure.
Just move the staticwebapp.config.json into the public folder and you are good to go.
I had the same problem. Our Azure App Servive was running PHP and Apache, so we used a .htaccess file like this one suggested in the deployment docs of Create React App. https://create-react-app.dev/docs/deployment#serving-apps-with-client-side-routing
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
Add the .htaccess to the public folder and this stops your refresh issue these types of Aapp Services.

running react bundle in Azure web app does not load json file

After building my react project it creates a bundle of files .js .json and index.html files.
I created a windows web app in azure.
When I deploy the bundle the page loads but none of the .json files do not load. I have seen other examples they talk webconfig changes but since this is a react project that does not apply.
I manually add a web.config in 'dist/prod' with the following to make it work.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
try it.
Note this for only static json files if your going to look dynamic content.you need add handler in config.files

How can I make my AngularJS SPA running on VS 2015 web development environment refresh correctly

I have an AngularJS SPA application that I have developed using Visual Studio 2015. When I click publish it publishes the index.html and works just fine. However if I am on a page and I click refresh then it tries to do a refresh of the SPA page such as example.com/home/about. This fails as I don't have a home/about page.
Is there some way that I could modify my web.config file (just for local testing) so that it would actually go to the index.html (load that up) and then to the /home/about state?
Here's my current web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
It seems you are using html5mode. In this case there's no # to keep the URL changing from requesting to the server.
With this configuration, you need help from the server. It will serve the index.html when it receives requests from your SPA routes.
This SO answer has details on configuring URL Rewrite on web.config:
Rules go by:
<system.webServer>
<rewrite>
<rules>
<rule name="AngularJS Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
It assumes your API is under: /api and for any directory or file that it finds, it serves as-is.
Anything else, gets rewritten to / which having default document configured to index.html, will load you SPA.
Also note you need to install the URL Rewrite module for IIS (IIS Express doesn't need the module)
Another option is one of these lightweight HTTP servers npm packages.
John Papa has one: lite-server. It uses BrowserSync under the hood:
BrowserSync does most of what we want in a super fast lightweight
development server. It serves the static content, detects changes,
refreshes the browser, and offers many customizations.
When creating a SPA there are routes that are only known to the
browser. For example, /customer/21 may be a client side route for an
Angular app. If this route is entered manually or linked to directly
as the entry point of the Angular app (aka a deep link) the static
server will receive the request, because Angular is not loaded yet.
The server will not find a match for the route and thus return a 404.
The desired behavior in this case is to return the index.html (or
whatever starting page of the app we have defined). BrowserSync does
not automatically allow for a fallback page. But it does allow for
custom middleware. This is where lite-server steps in.
lite-server is a simple customized wrapper around BrowserSync to make
it easy to serve SPAs.

Deploy angular application on IIS

I am working on AngularJs application with node.js. Using gulp, I have created (compiled) my application (app in below image) and got the following directories
Now I completely struck how to proceed next. I want to host this application over IIS to run and see the pages (in views folder) but I don't know how to host it on IIS.
I tried this article, but it guides to use express server.
The issue is, how IIS will figure out that the first page lies in views folder, and even if I use the complete url
http://localhost:8078/views/index.html
it shows me all angular code with brackets like {{logginuser}} etc
EDIT:
Do I need web.config file here or not. If yes then how I will define entry point to the application?
Just have to configure a Web Application under a website in IIS and create a custom web.config.
In IIS, go to the Default Web Site, right-click and select Add Web Application
Set the Alias to be AngularApp and the Physical Path to be the root of your directory
Add a web.config file at the root of the directory with the following code
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="views/index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Browse to your new Angular application by going to http://localhost/AngularApp (assuming http binding in IIS).
Lost 2 hours with this
The solution was to go to WINDOWS FEATURES and check 'static content', under COMMON HTTP features.
Hope this helps someone.
You need set as start page to you main screen (like index.html)
How can I set it in IIS?
Just go to web.config file and add following
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.html" />//Path of your Page
</files>
</defaultDocument>
</system.webServer>
More details : How do I set the default page of my application in IIS7?

How to host AngularJs application over IIS

I am new to AngularJs application and using Gulp to compile application. When I compile my application, it creates a directory with name app in my solution. I have the following folders in app.
This is deployable code and I want to deploy it on local IIS.
What is needed to tell IIS to start from or is configuration file needed there.
I set application pool like this
Any help please despite this awkward illustration.
This is not hard, as long as you are in control of your web.config. Basically what you need to do is a 301 Permanent Redirect.
This is how to do a mod_rewrite in IIS, under your web.config:
<system.webServer>
<rewrite>
<rules>
<rule name="directToSubFolder" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="/app/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
Note that the url in the action tag value should be whatever that suits your needs. I am assuming your default landing is an index.html
So with this, you can do your development as usual, once you want to deploy, you can run Gulp to build everything into app folder, and voila, you are done!

Resources