Need Help ASAP!!

R

Roshawn Dawson

Hi,

I have an xslt file located in the root directory. It is used by an aspx pages in both the root
directory and a subdirectory. But for some strange reason, the aspx page in the subdirectory can
neither locate the xslt file or the css file needed to get the desired results.

What's the problem? Can anyone help me?

Thanks,
Roshawn
 
P

Peter Rilling

Is the browser having trouble getting it, or some of your server code? How
are you trying to interact with it? Are you using relative or absolute
URLs? Is you are trying to do this on the server, are you accessing the
correct physical folder?
 
R

Roshawn Dawson

Hi Peter and thanks for responding.

I'm using relative urls. The browser doesn't have any trouble getting it. To give you a better
picture of what I'm dealing with, here's what I have:

1.) the root directory contains a default.aspx page, css file, and an xslt file that thats used by
the default.aspx page and a page in the subdirectory

2.) a subdirectory named "Foo" that contains a default.aspx page.

The xslt file creates the html output I want. Inside the xslt file I make use of the css file.

When it comes to the xslt file, ASP.NET gives me a System.IO.FileNotFoundException. It states that
it cannont find the xslt file in the subdirectory. I took that to mean that the xslt file must also
exist in the subdirectory.

I've checked to make sure that I'm doing everything as I should but nothing seems to work.

Thanks anyway,
Roshawn
 
P

Patrick.O.Ige

Can you post some small snippet what you are trying to do.
Patrick

Roshawn Dawson said:
Hi Peter and thanks for responding.

I'm using relative urls. The browser doesn't have any trouble getting it. To give you a better
picture of what I'm dealing with, here's what I have:

1.) the root directory contains a default.aspx page, css file, and an xslt file that thats used by
the default.aspx page and a page in the subdirectory

2.) a subdirectory named "Foo" that contains a default.aspx page.

The xslt file creates the html output I want. Inside the xslt file I make use of the css file.

When it comes to the xslt file, ASP.NET gives me a
System.IO.FileNotFoundException. It states that
 
R

Roshawn Dawson

Hi Patrick

This is the snippet from the default.aspx page in the subdirectory:

Private Sub GetDetails(ByVal id As String)
Dim sb as New StringBuilder()
sb.Append(ConfigurationSettings.AppSettings("ItemLookup") & "&SubscriptionId=" &
ConfigurationSettings.AppSettings("SubID") & "&Version=" &
ConfigurationSettings.AppSettings("Version") & "&Operation=ItemLookup&ItemId=" & id &
"&ResponseGroup=Large")
Dim tr As XmlTextReader = New XmlTextReader(sb.ToString)
Dim xDoc As XPathDocument = New XPathDocument(tr)
Dim htw As HtmlTextWriter = New HtmlTextWriter(Response.Output)
Dim trans as XslTranform = new XslTransform()
trans.Load(Server.MapPath(ConfigurationSettings.AppSettings("Myfile"))
trans.Transform(xDoc, Nothing, htw)
End Sub

This procedure is called during the Page_Load event. All I'm doing is attempting to transform the
xml that I receive from a third party (I actually get data so that is not an issue). Remember that
the xslt file is used by the default.aspx page in the root directory and the default.aspx page in
the subdirectory.

HTH,
Roshawn
 
J

Jevon

Hi Roshawn,

From that it looks like you're either misunderstanding how virtual
directories work, how Server.MapPath works, or both :)

By having "Myfile.xslt" in that variable in the sub directory, for example
/foo/, when you run Server.MapPath on it in /foo/default.aspx, you map to
/foo/Myfile.xslt, not /Myfile.xslt, as you seem to expect. Server.MapPath
works from the current path, not the root. I think, to get everything
working correctly, you just need to change the "Myfile" setting to
"../Myfile.xslt" - but only in the sub directory, not the root.

I don't know how the CSS is linked/how XLST tranformation actually works,
you might need to do something similar with the path to the CSS file as
well.

Jevon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top