Set application page as welcome page programmatically
By design, setting application page as welcome page is not possible, you can only choose page inside the web. Code below does following steps
1. Creates standard page (web part page) in Site Pages list on web
2. Adds Script Editor web part to the page
3. Adds javascript to Script Editor (from Media web parts) web part (to redirect to application page)
4. Sets this Site page as welcome page
You can do these steps also manually
In our case, ProjectHome.aspx is application page and ProjectHomeRedirect.aspx is site page.
Here it is:
Methods are then called in the same order