How do you allow parent paths in Visual Studio 2015? - asp-classic

I've opened an existing web application project from Visual Studio 2013 (which runs just fine), in Visual Studio 2015. When I run it from within Visual Studio 2015 I get:
Active Server Pages error 'ASP 0131'
Disallowed Parent Path
/blah/login.asp, line 1
The Include file '../includes/Security.asp' cannot contain '..' to indicate the parent directory.
My IISExpress applicationhost.config file already contains the entry:
<asp appAllowClientDebug="false" appAllowDebugging="false" errorsToNTLog="false" enableParentPaths="true" scriptErrorSentToBrowser="true" bufferingOn="true">
<session allowSessionState="true" />
<cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />
<limits maxRequestEntityAllowed="1073741824" />
</asp>
My web application properties are set to use IISExpress.
What could I be missing?

The 'applicationhost.config' has moved and is now located in the hidden .vs folder. Make sure you're updating the right file.

Here is a much clear explaination although the accepted answer is in the right direction.
Since VS2015, IIS Express has changed where it picks up your applicationHost.config file. This is presumably to simplify the distribution of projects. It has moved away from the traditional C:\Users\<profile>\Documents\IISExpress\config\applicationhost.config folder (although this file will still exist on your computer to support older VS installations).
It is now located in the application project's root folder as a hidden file. To save you hunting for it, here is how you open it quickly and easily:
Right click IIS Express from the tray icon and select Show All Applications.
Click on the URL entry of your application. The "Path" and "Config" values then are shown as hypertext links further down in the IIS Express window.
Click on the Config hypertext to open on your preferred editor. (e.g. C:\<Path-To-Project>\.vs\config\applicationhost.config)
Hope this helps.

I wanted to add my version of a very similar answer because I still had to do some searching to get the expected end results. Although the original question just really wanted to know why the current config that was being used was not working and it was in fact explained in the accepted answer, it did not help someone like me coming into the question. I needed to know everything to do in order to achieve allowing parent paths when debugging. So here is my answer in detail...
How to configure the IIS debug server in Visual Studio 2015 to allow parent paths:
First you need to find the IIS Express tray icon.
Next you need to open the IIS config currently running for debugging by right clicking on that tray icon. You will then see the following context menu. You will need to click on "Show All Applications".
This will then show you the configurations of the IIS debug server you are running. There will also be the project you are working on listed in this list.
Click the projects name (in this case "Web") under the Site Name column. You will then see the Path of the project and the Config file being use to run the debug IIS server. You will then click on the Config path to open the applicationhost.config in your default text editor.
This will open up the config file you are using when debugging your project. You will need to scroll down until you find the <system.webServer> section. Then look for the <asp> section. In my case it was <asp scriptErrorSentToBrowser="true">.
Then you just need to edit the asp section to include enableParentPaths="True" as shown in the image below.
The just save the file and restart the debugging process. Note: I only had to hit F5 in the IE browser to see the change. I did not have to close the browser and restart the debug process over again.

Related

Create a solution and run it for an ASP.net website that has code only in folders

I have a website that is currently running on IIS for an internal website for a company.
I didn't receive a solution to open in Visual Studio, I only have a folder with the files that are deployed in the production server on an "asp_applications" folder.
Inside of it there is one folder for each website's code, so far I've been modifying the aspx.inc and aspx files in a notepad++ in order to do some bug fixing, and tweaking of functionalities, but not having a proper setup in Visual Studio is limiting my ability to work.
I tried creating a solution in Visual Studio and adding the folder with the code:
the website in production opens to http://XXXX.YYYY.com/index.aspx?fuseaction=home.approvepos so I went to my new solution and opened the index.asp file. which has the following:
here I tried to run and get an error
after clicking yes I get the following error
and following this instruction I added the required piece to the web.config
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="false" />
</appSettings>
however I'm still not able to run in local this page. can you help me understand what am I doing wrong? I would like this so I can debug my website and have some intellisense and normal stuff from the IDE to be able to develop a little easier.
please let me know if there is more information I could provide.
Thank you and have a great day :)
P.S. this is a small list of the type of files that there is

Adding global.aspx file

I am currently using IIS to host a simple website, and would like to know how to enable the 'Global.aspx' file? I need to know where I would define it, as all the tutorials talk about using Visual Studio, which I am not using.
File Global.asax should be placed on the root directory of your site. There is nothing else to do besides adding required code, you put it there and just work.
Just right-click on the project name displayed in the Solution Explorer, and choose Add New..., then choose Global.asax from the list displayed in the new popup window. It goes to the root of your application.
Here is further information: Where is the Global.asax.cs file?

Rich text editor with standalone apps under Sitecore web root

I've been trying to configure a standalone ASP.Net application beneath a Sitecore web root (more or less as outlined here: http://sitecoreblog.alexshyba.com/2009/05/standalone-apps-under-sitecore-web-root.html). It's almost successful in that the virtual directory runs, but in the /sitecore folder, the rich text editor no longer works. Here is the error it throws:
'~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager.
It works fine when I revert back to the original configuration.
Does anyone know how to properly configure this?
More info (1):
So, in the sitecore web.config, at the root, I added:
location path="." inheritInChildApplications="false" above the sitecore, system.webserver, and system.web nodes. The non-sitecore app I was attempting to run works great when I do this, but it somehow creates the Telerik.Web.UI.WebResource.axd I mention above, in the /sitecore folder, mostly when using the rich text box.
More info (2): This happens when I make these changes to the web.config in the sitecore root. While attempting to fix the problem, I did make a few changes to the web.config files in the /sitecore folder (including deleting them). but it made no difference. I've since restored the /sitecore folder to it's original configuration.
The standalone app is running as a separate app, immediately off the root, so: http://mysitecoresite/mystandaloneapp.
I had the same problem. After much searching, this fixed it for me (using v7.2 rev 140228): http://docs.telerik.com/devtools/aspnet-ajax/controls/scriptmanager/troubleshooting/overview#telerikwebuiwebresourceaxd-is-missing-in-webconfig-radscriptmanager-requires-a-httphandler-registration-in-webconfig
You have to set the EnableHandlerDetection property where it is declared on the Sitecore .aspx pages. I found it on EditorWindow.aspx and EditorPage.aspx.
<telerik:RadScriptManager ID="RadScriptManager" runat="server" EnableHandlerDetection="false"></telerik:RadScriptManager>

Web publishing in ASP.Net does not publishes for following file formats

I am trying to publish a web site, in which css directory includes different files for font settings.
Following are the file & extensions:
calibri-webfont.eot
calibri-webfont.svg
calibri-webfont.ttf
calibri-webfont.woff
calibri-webfont.oft
Now when I try to publish website, it just publishes .svg file,other files I need to copy manually.
Whiles publishing following options I have checked:
Replace matching files with local copy
Only files needed to run this application.
Expected: as all those files are required, I want those to be get published automatically, than manually coping those.
How this can be achieved?
I know you asked this a very long time ago, but today it ranks high on Google and I've just had the same problem. Today's fix was that Azure does not have MIME types configured for several font file formats. This must be added to web.config otherwise Azure simply returns a 404 error (even though the files are actually published).
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
Source:
http://www.codepal.co.uk/show/WOFF_files_return_404_in_Azure_Web_Sites
If your files are not included in the project (just in the file structure), in visual studio click the Show All Files Icon in the solution Explorer (looks like 3 pages). Right Click on the files and select "Include in Project"
Access the file properties by right clicking, then make sure the Build Action property is set to "Content".
file properties by right clicking, then make sure the Build Action property is set to "Content".
Works fine

Why doesnt my img show up in ASP.NET

I created a C# web project with MSVS 9 and thats all i know about my configurations.
In my browser i can access any aspx files i have in my project. However when i use http://localhost:3288/img/test.png i see nothing. The working directory is ./root, the png file is in ./root/img/test.png How do i have ASP.NET display my images and everything else in the folder? (and subfolders).
Is the .png included in the solution?
When you hit the "play" button your essentially starting up a new website ( localhost:2383 ) so if its not in the solution it won't be copied over to the new, temporary, website that the debugger attaches too.
If this is the problem a quick fix is to hit the "Show all Files" button on the top of your solution explorer, this will show all the files in that folder on your hard drive. Then right click on the .png you want to include and hit "Include in Project".
Based on your comment your only solution is to actually create an IIS site for your solution with the root dir the same as your web project. Then in the project properties you'll have to tell the debugger to attach to your local IIS instead of visual studios. Not sure the exact click path, right click on your project and go to properties, look for debugging options.
Give a look to the ASP Image control , you can specify paths starting in your app root (~):
<asp:Image id="Image1" runat="server"
ImageUrl="~/Images/image1.png"/>
Or you can use relative paths to the page that are displayed.
Check this article about ASP .NET Website Paths.

Resources