What is this type of redirection called - redirect

My website uses Response.Redirect("~/Main/Main.aspx") type redirects all over the place. Worked flawlessly until the Webhost4Life (don't groan) decided to migrate my website and in doing so managed to completely break it.
What is this "~" mechanism actually called?
Thanks, Rob.
PS. The bug is that Response.Redirect("~/main.aspx") from http://backdoor.whatpub.org/default.aspx doesn't go to http://backdoor.whatpub.org/main.aspx (as it did on the old server) but to http://backdoor.whatpub.org/live/main.aspx. Live is the name of the sub-folder containing the website and AFAIK means that the root is getting returned as http://backdoor.whatpub.org/live and not just http://backdoor.whatpub.org

it is a shortcut to HttpRuntime.AppDomainAppVirtualPath property, which refers to the virtual application root, not the root of the web server.

Related

Error: 404 The page you're looking for could not be found (gitlab). How to resolve it?

Let's say I have some website with the name website.eu. When I deploy it and try to get access to a page online like this website.eu/about I catch the error:
"404 The page you're looking for could not be found. The resource that you are attempting to access does not exist or you don't have the necessary permissions to view it"
When I click on the link that brings me a website.eu/about it works well, but trying to type that URL in the input field it fails.
Everything works fine locally.
The project is developed using Vue3.
The project is no GitLab.
If someone helps I would appreciate it.
Hard to tell without seeing the code, but my guess is your router setup uses the web history mode, which relies on the server to have certain settings applied.
I believe switching to hash mode (while adding # to the routes) will work.
Alternatively, you can update your server to support redirects to have the html mode work.
example server configurations

Github not detecting an inner index.html

I'm publishing my own profile site on github on https://yilmazhasan.github.io/pwp
It was working before some changes, now it gives 404 for https://yilmazhasan.github.io/pwp/src/index.html although there is an index.html file.
I'm redirecting pwp/index.html to pwp/src/index.html, it sees first one but not second one.
Since it is public, they can be seen on https://github.com/yilmazhasan/pwp
What can be caused to this?
(Note: It works on localhost)
Even without redirecting pwp/index.html to pwp/src/index.html, you could simply change your publication folder to src, as seen here (for the docs folder, but the same idea applies)

Joomla! Too Many Redirects

I'm trying to build a website (it's not my first time), using latest version of Joomla! (3.8.10), but I have a problem - tabs in the main menu don't work. When I try to go to other page, I have an error:
ERR_TOO_MANY_REDIRECTS
I almost solved this problem by changing:
$sef="1"
to
$sef="0"
in configuration.php, but it caused strangely long addresses.
Ok, I found the solution. Need to add:
$_SERVER['HTTPS']='on';
in index.phpfile, behind the <?php
Maybe someone will use it.
This is most likely a problem with your .htaccess file. When you change $sef=0, you are basically telling the system to not use your .htaccess file. I suggest backing up your current one and replacing with the default Joomla one. It is the one that comes in the download package and is named htaccess.txt. Upload and rename to .htaccess to overwrite existing.

merge large existing web app into Sailjs site

I'm trying to merge large existing web app into sails.js. so I moved the folders into assets and build a custom route , 'GET /': '/assets/client/launch.html' and get 404 when I point my browser to http://localhost:1337/ as the / is correctly redirected to http://localhost:1337/assets/client/launch.html which produces the 404.
Now the file exists in the folder assets/client (and in .tmp), so I am thinking the Sails router is getting in the way.
I would leave the client (70K lines of JS) that generates all the UI dynamically and sailjs server that provides authentication separate and enable CORS but my customer wants client packaged with server. This type of operation is simple in frameworks like ASP.NET MVC but am wondering if Sails is up to the task.
Well, If everything you tried did not work out. There might be another solution ,
First of all since you are talking about sails app I am assuming other bundle must be sails as well ,
So here is what you do-
Change the port for another app that you want to attach to this.
Second whenever you want to go to page on another app simply redirect the client to another port ie
in html or esp put a href tag with different port.
<a href="localhost:PORT/route_to_file">
</a>
I got it working by placing my app into assets where we need to launch from assets/client/index.html as there would be too many dependencies to change. As I said above could not just add a route as Sails must getting in the way. However as in Chapter 3.2.2 of Sails in Action I generated a static asset npm install sails-generate-static --save. then I redirected to assets/client/index.html. As an aside that book is great and would highly recommend it.

Deploying MVC2 application to IIS7.5 - Ninject asked to provide controllers for content files

I have an application that started life as an MVC (1.0) app in Visual Studio 2008 Sp1 with a bunch of Silverlight 3 projects as part of the site. Nothing fancy at all. Using Ninject for dependency injection (first version 2 beta, now the released version 2 with the MVC extensions).
With the release of .Net 4.0, VS2010, MVC2 etc., we decided to move the application to the newest platform. The conversion wizard in VS2010 apparently took care of everything, with one exception - it didn't change references to mvc1 to now point to mvc2, so I had to do that manually. Of course, this makes me think about other MVC2 things that could be missing from my app, that would be there if I did File -> New Project... But that is not the focus of this question.
When I deploy this application to the IIS 7.5 server (running on Win2008 R2 x64), the application as such works. However, images, scripts and other static content doesn't seem to exist. Of course they are there on disk on the server, but they don't show up in the client web browser.
I am fairly new to IIS, so the only trick I knew is to try to open the web page in a browser on the server, as that could give me more information. And here, finally, we meet our enemy. If I try to go directly to the URL of one of the images (http://server/Content/someimage.jpg for instance), I get the following error in the browser:
The IControllerFactory 'Ninject.Web.Mvc.NinjectControllerFactory' did not return a controller for a controller named 'Content'.
Aha. The web server tries to feed this request to MVC, who with its' default routing setup assumes Content to be a controller, and fails.
How can I get it to treat Content/ and Scripts/ (among others) as non-controllers and just pass through the static content? This of course works with Cassini on my developer machine, but as soon as I deploy, this problem hits.
I am using the last version of Ninject MVC 2 where the IoC tool should pass missing controllers to the base controller factory, but this has apparently not helped. I have also tried to add ignore routes for Content etc., but this apparently has no effect either. I am not even sure I am addressing the problem on the right level.
Does anyone know where to look to get this app going? I have full control of the web server so I can more or less do whatever I want to it, as long as it starts working.
Thanks!
I had a similar problem with StructureMap and favorite.ico what I ended up doing was to add a route to ignore that path.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
Keep in mind that I have absolutely no idea really but another thing that changed is the need for Default.aspx, also if you have any custom pages those would need to mapped. That's the only two problems I had with routing.
routes.RouteExistingFiles = false;
EDIT: I meant that the RouteExistingFiles should be false otherwise I get that exception in MVC2 :)
Turns out this was caused by some account settings - I was unaware of the IIS AppPool\sitename account automatically being created by IIS in Win2008 R2 server. After trying "everything", I came across this information, gave the proper rights, and stuff magically started working.
Pretty hard thing to debug, especially for someone (me) with very limited IIS experience.