Last post Feb 09, 2017 12:53 PM by PatriceSc
Feb 08, 2017 04:17 PM|rajsedhain|LINK
I just update visual studio 2012 to 2015. It works great in 2012 but in 2015 I got the following error:
Cannot use a leading .. to exit above the top directory
I have 2 projects - One has login page and another uses the login page from first project:
Wen.config of first project has this:
<forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" timeout="60" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile"/>
second project has the web.config file:
<forms name=".ASPXAUTH" loginUrl="~/../Library/Login.aspx" protection="All" timeout="60" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" />
Now, if I run the first web project, it works fine but second throws the above error. I can't hit run directly via visual studio but I can deploy that in IIS 10.0 which works fine (localhost).
I need to debug the second one so I have to figure it out what is the problem when run directly via studio.
Feb 08, 2017 05:20 PM|PatriceSc|LINK
You are really trying to reach a Library folder which is upper than your application root? You are not supposed to be able to serve a file which is not part of your website. If the Library folder is under the application root use ~/Library/Login.aspx instead.
If you want to share a common page accross multiple applications you likely have some options but they are all more complex and error prone (ie you have the potential to mistakenly break all your apps at once) over copying some assets from a common source
and upgrading them from this source if and when you want. Make sure you get more benefits than harm if you want to take this path.
Feb 08, 2017 06:13 PM|rajsedhain|LINK
thanks for your reply. I tried using ~/Library/login.aspx but it's in different project and can't find this location. It's not in application root.
I have this login.aspx page in first web project and I want to use this in other projects as well. I may have to change whole concept...
Feb 08, 2017 06:50 PM|PatriceSc|LINK
Yes, AFAIK most if not all web servers just won't serve - at least directly - a file which is not part of the current web site (ie which is not under the web application root folder).
Else anyone could try something such as
http://yoursite.com/../../outside.txt to attempt grabing some file that is not supposed to be "published" through a url...
Feb 08, 2017 07:07 PM|rajsedhain|LINK
it's in the same solution with different project. I have added dependencies as well.
Second project depends on library project (redirect to login page if not authenticate).
It used to work in 2012 but having issue since updated to 2015.
Thanks for your quick reply.
Feb 08, 2017 07:21 PM|PatriceSc|LINK
You likely have done something else to make it work. Could it be that you used something called "enable parent path" ? Or maybe you published a site and a sub site rather than - as it seems the case here - two sites that are at the same level?
Feb 08, 2017 07:26 PM|rajsedhain|LINK
I've already checked that and there is no Enable parent Path to true. I tried it to setting up in the new environment but still no luck.
Yes both are at the same level web projects in a solution.
Feb 09, 2017 09:47 AM|Cathy Zou|LINK
From your error message,
It means that one of the paths has a ".." at the beginning of it that would result in exiting the web site's root folder hierarchy. You need to google "asp.net relative paths" or something like that to help you with your problem.
BTW, a hint to where the problem is is included in the exception page that you saw. It will actually tell you what file it found the problem in.
To head off future occurences of this exception, do a search in the entire solution for this string: "../". If you find any of those in files in the root path of your web site, address them.
It seem the it relate to the path of wepage.
Feb 09, 2017 12:53 PM|PatriceSc|LINK
And you don't have anymore this version handy? I don't see how it could work this way without at least the "enable parent path" feature (which should prevent to point outside of the web site). If this is not what you used, are you sure you used a ~/../outside
approach rather than some other know approach for this ????
If you don't find how you made it work previosuly, I believe we should now focus on making this work regardless of how you have done previously. And to start with you are 100% it does Worth to share a single physical copy of those files accross multiple
applications rather than to just copy as needed this file (that should change unfrequently) into each application.
Also the goal is just to share this file to avoid duplication or do you want something such as having single sign on accross multiple applications installed on this server ?