Issue with path using twig templates - path

I'm currently resuming an existing project and I'm facing path issues with a twig (the project use no framework for twig templates). I'm trying to run this project locally with wampserver. I defined my new base-path so that wamp can run it but it can't redirect me correctly when I'm using forms for example. It can't also find paths to images.
For example, I can try to connect using the URL:
localhost/autres/admin_LP/admin
but when I submit I'm redirected to:
localhost/admin/dashboard
instead of:
localhost/autres/admin_LP/admin/dashboard
In other terms, the part "/autres/admin_LP" is missing.
It's the same issue for images, the path is wrong:
incorrect path for image
The image path should be:
localhost/autres/admin_LP/Web/template/View/Easylife.png
instead of:
localhost/Web/template/View/Easylife.png
Apparently, I correctly modified the .htaccess since I'm directed towards the connection page. But since the project uses twig templates, I think I missed some twig configuration so that it can find the right path.
I'm a rookie with twig templates so if you have any clue about how I can properly run my project locally, I'm more than interested!

Related

Taking website down with app_offline during web deployment through pubxml file

I have just recently found out that IIS web deploy 3.0 and newer versions do support feature of taking website down while doing a deployment by using this property inside the .pubxml file:
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
This works fine - it generates a file called App_Offline.htm in my website's root directory...
However - the file generated like this is completely empty - but I don't want it to be empty. I wanna place custom HTML there and I cannot seem to find a way to do this. I cannot see from where is this file being generated - nor do I have any clue how to place custom HTML inside that page during web deployment.
Has anyone had a similar issue like this ?
I've checked all the documentation on this but I can't seem to find a solution..:/
Can someone help me out ?

Web API Help Pages not loading documentation XML

I'm trying to set up the ASP.NET Help Pages to run in an existing MVC project, though pointing towards the documentation file from a Web API project in the same solution. Convention has the Help Pages running inside the Web API that it's documenting but in this case I want it in a sibling MVC project.
The Web API project outputs its documentation XML file in a folder within the MVC project.
I've installed the Microsoft.AspNet.WebApi.HelpPage NuGet package in the MVC project. This creates a class \Areas\HelpPage\App_Start\HelpPageConfig.cs, and within this class's Register method I've passed the XmlDocumentationProvider the path to the Web API's documentation file.
But when I load the page, it's empty, aside from a title and a placeholder description.
Upon debugging the HelpController.Index method, I can see in the returned IApiExplorer that the _apiDescriptions are empty.
However, if I install the Help Pages directly into the Web API project and debug the same method, I can see that the _apiDescriptions are now present.
Can anyone explain what the Web API project is doing or has configured which the MVC project isn't doing or hasn't configured?
Just set this up myself, and I think I ran into a similar issue, if i'm reading what you're saying correctly.
Try the following:
Go to Areas\HelpPage\App_Start\HelpPageConfig.cs. Around line 36, you'll want to make sure you uncommented the line as below:
//// Uncomment the following to use the documentation from XML documentation file.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/ApiDocumentation.xml")));
And make sure the path is correct. I happened to put my xml file in the App_Data directory.
Go to Project=>Properties=>Build. Under Output, make sure the "XML documentation file" box is checked, and point it to App_Data\ApiDocumentation.XML (assuming you put it in the same place i did above.
If i remember correctly, i had to make sure i added the .xml file to the project- i had some problems when i tried publishing it to our test server at work and it said the file couldn't be found. After you build, simply go to App_Data, right click on the folder, and add existing item. navigate to App_Data in your file system and select the xml file.
This will hopefully fix your problem!
I'm not sure if this will help anyone else that stumbles across this, I had started with a blank template from VS and added the help files via the Nuget package.
Because it was a blank template and I had no areas set up, it was missing the following from the global.asax
AreaRegistration.RegisterAllAreas();
This prevented the HelpPageConfig.Register from being called and thus, the Xml Documentation provider was never set.

download source code, but not working

I had a problem with part 3 of an orchard tutorial...
so I was attempting to download the source code for part 4 and continue on from there (which can be found about 3/4 of the way down at the end of the tutorial on the page http://skywalkersoftwaredevelopment.net/blog/writing-an-orchard-webshop-module-from-scratch-part-4
However when I run part 4 from webmatrix I get the error(see below)
im guessing this is because iv only downloaded the code but i need to put it inside a seperate project? is this correct? can someone advise me how to do this?
thanks for any replies
The error states that there is no default document configured in IIS. Attempt to access the document using the full URL.
For instance http://localhost:28266/default.aspx (or similar)
You can then adjust IIS to have the correct default document (if desired)
Edit: After reviewing the referenced ZIP archive.
This looks like a changed file zip for the application. This isn't a complete ASP.NET MVC application by itself and, as such, isn't viewable stand alone. I don't have the time to parse the exact steps required to make this application work alongside the demos provided, but be sure you're either combining all of the previous files and folders in order or follow the instructions detailed by the author.
As referenced, this is not a complete ASP.NET MVC application and isn't ready to be immediately rendered by IIS.
The problem is probably that the application can't start for some reason, which causes IIS to attempt to respond to the request with other handlers. Because there is no default document defined (and there shouldn't), it tries to do a directory listing, which is not allowed in your configuration. Do not focus on what IIS is telling you but rather on why your application doesn't run.
Things to check:
you have built the application
you are running in full trust
you are running in integrated mode
there is no exception in app_data/logs
you added the module to a working Orchard instance, in its Modules directory

How to access the project documentation pages created using Gdoc in grails

I followed the tutorial on the grails documentation was successfully able to create project specific documentation pages by running the following command
grails doc
I was able to view the HTML pages from my desktop and I found them on the following directory:
..\target\docs\index.html
I was wondering how to access these generated HTML pages from the server. What is the URL to view them from the server?
I tried the following URL but did not work?
http://localhost:8080//docs/index.html
Also, the grails documentation states that the command will output an docs/manual/index.html
page. Rather I found the index.html page on the following directory:
..\target\docs\index.html
Can anyone help me in this?
Thanks
They're not built to be viewed from the running application, so they're not automatically exposed as a url. But you can move them to the web-app folder and they'll be accessible.
You can also configure the build location to be under web-app. Add this line to grails-app/conf/BuildConfig.groovy:
grails.project.docs.output.dir = 'web-app/docs'

MVC application deployed to IIS5 using Wildcard mapping causes 401 and 404 errors on CSS and JS

I've been developing an MVC 2 application under the built in Web-server in VS2010. On Friday, I moved it to a virtual directory under IIS 5 in my WinXP development machine. I had the usual problems, and added a wildcard mapping to the Virtual Directory configuration in IIS to map .* to aspnet_isapi.dll (Framework 4). Neither the check file exists box nor the Script Engine box is checked.
The routing works and brings up the correct page. But none of the css or js files are served. Fiddler shows them getting either 401 (Not Authorized) or 404 (Not Found) errors (with no apparent rhyme or reason to which one - sometimes both). I went back in and added IgnoreRoute statements to the mapping tables for .css and .js, files, but that made no difference. I also added LOCALMACHINE\ASPNET to the security settings on the directory, giving it (for right now) full control permissions (I know that's a security hole, but I'll fix it after I get it running.)
I have not seen this problem referred to in any of the blog posts on getting MVC running on pre-IIS 7 servers. Has anyone else seen it, and how did you solve it?
The simplest and most straightforward way I've found to get the scripts/graphics/css files working is to specifically remove the wildcard mapping to aspnet_isapi for your content directories (graphics, scripts, css), in the same way that you added them for the project directory.
Right click on your scripts folder and select properties, and hit Create. The configuration button will now be available; click it and hit Remove to remove the custom mapping that the folder inherited from it's parent; click okay. Now back in the properties dialog for the folder, click Remove, so it's no longer a virtual directory, and click OK. Repeat for other such folders.
This is because when your app servers url like : www.domain.com/Controller/Param1/Param2/Param3 it will try to get images from www.domain.com/Controller/Param1/Param2/Param3/images. Try to install firebug and see the net section. Good fix to this is use a helper method to add css reference that adds fully qualified path for css reference like: www.mydomain.com/css/my_css.css

Resources