Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Error: Cannot use a leading .. to exit above the top directory. (http://www.velocityreviews.com/forums/t757747-error-cannot-use-a-leading-to-exit-above-the-top-directory.html)

Nathan Sokalski 05-30-2005 07:54 PM

Error: Cannot use a leading .. to exit above the top directory.
 
When running a page I am working on, I recieve the following error:

Cannot use a leading .. to exit above the top directory.

I suspect this has something to do with the problem I posted in a recent
posting "HyperLink.NavigateUrl always adds an extra ../ when going to a
higher level directory" on Sunday, May 29, 2005 7:33 PM
However, I cannot be sure because I cannot view the generated code since it
gives the error before anything is shown, and the debug goes through all my
code with no errors until the end of the Page.Load event (it makes it
through all of the code I wrote). My Stack Trace is as follows:

[HttpException (0x80004005): Cannot use a leading .. to exit above the top
directory.]
System.Web.Util.UrlPath.Reduce(String path) +701
System.Web.Util.UrlPath.Combine(String basepath, String relative) +304
System.Web.UI.Control.ResolveClientUrl(String relativeUrl)
System.Web.UI.WebControls.HyperLink.AddAttributesT oRender(HtmlTextWriter
writer) +58
System.Web.UI.WebControls.WebControl.RenderBeginTa g(HtmlTextWriter
writer) +17
System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) +17
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +72
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.WebControls.WebControl.RenderContent s(HtmlTextWriter
writer)
System.Web.UI.WebControls.TableCell.RenderContents (HtmlTextWriter writer)
System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) +29
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +72
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.WebControls.WebControl.RenderContent s(HtmlTextWriter
writer)
System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) +29
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.WebControls.Table.RenderContents(Htm lTextWriter writer)
System.Web.UI.WebControls.WebControl.Render(HtmlTe xtWriter writer) +29
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +72
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +72
System.Web.UI.HtmlControls.HtmlForm.RenderChildren (HtmlTextWriter writer)
+44
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTex tWriter output) +262
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +72
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +131
System.Web.UI.Page.ProcessRequestMain() +1926

What can I do about this? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/



lisa@starways.net 05-31-2005 11:45 AM

Re: Error: Cannot use a leading .. to exit above the top directory.
 
Nathan Sokalski wrote:
> When running a page I am working on, I recieve the following error:
>
> Cannot use a leading .. to exit above the top directory.
>
> I suspect this has something to do with the problem I posted in a recent
> posting "HyperLink.NavigateUrl always adds an extra ../ when going to a
> higher level directory" on Sunday, May 29, 2005 7:33 PM
> However, I cannot be sure because I cannot view the generated code since it
> gives the error before anything is shown, and the debug goes through all my
> code with no errors until the end of the Page.Load event (it makes it
> through all of the code I wrote). My Stack Trace is as follows:


You could try putting a breakpoint on Page.Load and stepping through
the method. Check in the Command Window to see what the value of that
variable is. Worse comes to worse, you can add something like this:

If YourVariable.BeginsWith("../") Then
YourVariable = Substring(YourVariable, 4)
End If

Or maybe that should be three. I can never remember if Substring is 0
based or 1 based.

Lisa


Nathan Sokalski 05-31-2005 09:21 PM

Re: Error: Cannot use a leading .. to exit above the top directory.
 
I have tried using the breakpoint on Page.Load method, and I do not get any
errors in that event and all of the variables are what I expect and want
them to be while stepping through the code. The extra ../ is not added until
the A tag is generated (which means I cannot view the value of the href
attribute through a property in the Page.Load event). Because all of the
variables and properties are what I want and expect them to be during
execution, your suggested technique of using the SubString() method would
not work in all cases because of situations. For example, look at the
following code:

myanchor.NavigateUrl="comments.aspx"

In this situation, "../" would never be removed from the beginning of the
String because it is not there to remove, yet it would still be added during
the generation of the href attribute. I was looking at the
Control.ResolveUrl method, which sounded like it might be what I wanted, but
it is a method of the Control class, and the code where I assign the
NavigateUrl property is in a separate class I have written. Any ideas?
Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

<lisa@starways.net> wrote in message
news:1117539945.601412.186620@z14g2000cwz.googlegr oups.com...
> Nathan Sokalski wrote:
>> When running a page I am working on, I recieve the following error:
>>
>> Cannot use a leading .. to exit above the top directory.
>>
>> I suspect this has something to do with the problem I posted in a recent
>> posting "HyperLink.NavigateUrl always adds an extra ../ when going to a
>> higher level directory" on Sunday, May 29, 2005 7:33 PM
>> However, I cannot be sure because I cannot view the generated code since
>> it
>> gives the error before anything is shown, and the debug goes through all
>> my
>> code with no errors until the end of the Page.Load event (it makes it
>> through all of the code I wrote). My Stack Trace is as follows:

>
> You could try putting a breakpoint on Page.Load and stepping through
> the method. Check in the Command Window to see what the value of that
> variable is. Worse comes to worse, you can add something like this:
>
> If YourVariable.BeginsWith("../") Then
> YourVariable = Substring(YourVariable, 4)
> End If
>
> Or maybe that should be three. I can never remember if Substring is 0
> based or 1 based.
>
> Lisa
>




Mythran 06-01-2005 09:10 PM

Re: Error: Cannot use a leading .. to exit above the top directory.
 

"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:%233C$vaiZFHA.3328@TK2MSFTNGP09.phx.gbl...
>I have tried using the breakpoint on Page.Load method, and I do not get any
>errors in that event and all of the variables are what I expect and want
>them to be while stepping through the code. The extra ../ is not added
>until the A tag is generated (which means I cannot view the value of the
>href attribute through a property in the Page.Load event). Because all of
>the variables and properties are what I want and expect them to be during
>execution, your suggested technique of using the SubString() method would
>not work in all cases because of situations. For example, look at the
>following code:
>
> myanchor.NavigateUrl="comments.aspx"
>
> In this situation, "../" would never be removed from the beginning of the
> String because it is not there to remove, yet it would still be added
> during the generation of the href attribute. I was looking at the
> Control.ResolveUrl method, which sounded like it might be what I wanted,
> but it is a method of the Control class, and the code where I assign the
> NavigateUrl property is in a separate class I have written. Any ideas?
> Thanks.
> --


Could the problem posted below be the same problem you are having? Seems to
me to be :)

http://support.microsoft.com/default...;en-us;Q226474

Mythran


Nathan Sokalski 06-01-2005 10:46 PM

Re: Error: Cannot use a leading .. to exit above the top directory.
 
It doesn't look like it, for several reasons. First of all, the article you
mention is for ASP, not ASP.NET. Second, the error message is different (my
error message is about going above the top directory, while the article you
mention is about parent directories). And most important, the extra ../ in
my error is generated without me being told about it. The ../ in the article
is hard coded (the coder knows it is there, they type it as part of their
code). I don't think that this is the same problem I am having.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

"Mythran" <kip_potter@hotmail.comREMOVETRAIL> wrote in message
news:edeMh5uZFHA.2996@TK2MSFTNGP10.phx.gbl...
>
> "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
> news:%233C$vaiZFHA.3328@TK2MSFTNGP09.phx.gbl...
>>I have tried using the breakpoint on Page.Load method, and I do not get
>>any errors in that event and all of the variables are what I expect and
>>want them to be while stepping through the code. The extra ../ is not
>>added until the A tag is generated (which means I cannot view the value of
>>the href attribute through a property in the Page.Load event). Because all
>>of the variables and properties are what I want and expect them to be
>>during execution, your suggested technique of using the SubString() method
>>would not work in all cases because of situations. For example, look at
>>the following code:
>>
>> myanchor.NavigateUrl="comments.aspx"
>>
>> In this situation, "../" would never be removed from the beginning of the
>> String because it is not there to remove, yet it would still be added
>> during the generation of the href attribute. I was looking at the
>> Control.ResolveUrl method, which sounded like it might be what I wanted,
>> but it is a method of the Control class, and the code where I assign the
>> NavigateUrl property is in a separate class I have written. Any ideas?
>> Thanks.
>> --

>
> Could the problem posted below be the same problem you are having? Seems
> to me to be :)
>
> http://support.microsoft.com/default...;en-us;Q226474
>
> Mythran
>




Sergey Polyakov 06-06-2005 03:41 PM

Re: Error: Cannot use a leading .. to exit above the top directory.
 
Hi Nathan

If I understand you correctly, you are creating a Hyperlink child control
inside your own control. If so you can try to add the href attribute
directly to the Hyperlink's Attributes collection instead of assigning its
NavigateUrl property. The attribute value will be rendered directly as you
specified it without any additional processing.

If you are using a Hyperlink control directly on a page, you can try to use
the MapPath method to resolve the url before assigning.

May be this will help :-)

--
Best regards,
Sergey


"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:uu3nPvvZFHA.3096@TK2MSFTNGP15.phx.gbl...
> It doesn't look like it, for several reasons. First of all, the article
> you mention is for ASP, not ASP.NET. Second, the error message is
> different (my error message is about going above the top directory, while
> the article you mention is about parent directories). And most important,
> the extra ../ in my error is generated without me being told about it. The
> ../ in the article is hard coded (the coder knows it is there, they type
> it as part of their code). I don't think that this is the same problem I
> am having.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
>
> "Mythran" <kip_potter@hotmail.comREMOVETRAIL> wrote in message
> news:edeMh5uZFHA.2996@TK2MSFTNGP10.phx.gbl...
>>
>> "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
>> news:%233C$vaiZFHA.3328@TK2MSFTNGP09.phx.gbl...
>>>I have tried using the breakpoint on Page.Load method, and I do not get
>>>any errors in that event and all of the variables are what I expect and
>>>want them to be while stepping through the code. The extra ../ is not
>>>added until the A tag is generated (which means I cannot view the value
>>>of the href attribute through a property in the Page.Load event). Because
>>>all of the variables and properties are what I want and expect them to be
>>>during execution, your suggested technique of using the SubString()
>>>method would not work in all cases because of situations. For example,
>>>look at the following code:
>>>
>>> myanchor.NavigateUrl="comments.aspx"
>>>
>>> In this situation, "../" would never be removed from the beginning of
>>> the String because it is not there to remove, yet it would still be
>>> added during the generation of the href attribute. I was looking at the
>>> Control.ResolveUrl method, which sounded like it might be what I wanted,
>>> but it is a method of the Control class, and the code where I assign the
>>> NavigateUrl property is in a separate class I have written. Any ideas?
>>> Thanks.
>>> --

>>
>> Could the problem posted below be the same problem you are having? Seems
>> to me to be :)
>>
>> http://support.microsoft.com/default...;en-us;Q226474
>>
>> Mythran
>>

>
>





All times are GMT. The time now is 06:15 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.