Quote:
quote:dparsons wrote: I see what your doing and I have noted where in your code you having a problem, except I dont know what your specific problem is other then you can't pull the file.
Is the runtime throwing an error? Is the file just not being displayed? Are you using impersonation for your application? Can the test server "see" the unc path?
Please clarifiy. ^^
|
Quote:
quote: Can you explain further what you mean by "pulls the file"?
What exactly are you trying to accomplish? I can't really tell by reading the code.
There is an inherent problem with testing web apps in VS2005. When you run the app (assuming you are using the typical process) it's running in the ASP.NET test web server application. This is started with you "run" from visual studio. The test web server runs under the authority of the user you are logged in as. In a deployed scenario, IIS is running under a system account. There is a significant difference between the behavior of the app because of this. If you are trying to access network (files) you have success when you test run it in the debugger. But when deployed the runtime identity (the system account) has no rights to access the network resource.
One way to test this is to set up the app to mimic the deployed environment. Point it at a networked file, and run the app under IIS on your dev machine (assuming you have it installed). This is about the only way you can confirm that things are behaving correctly before you deploy the app.
-Peter
|
I apologize for not being more clear on what I'm needing help with. I have a complicated setup, and I wanted to keep the post simple.
My Setup
I have a MasterPage setup that works with the FileInfo Class. Once I've pulled in the requested page's path (aka "pulls the file") using Dim strPagePath = Request.ServerVariables("PATH_INFO"), I first check to see if the requested file exists on the test server using the FileInfo Class. If it
does exist, that file is then loaded. If it
does not exist, the home page is loaded as a default. This is the section of code that does this:
Code:
'Check if files exist
If Not fi.Exists Then
strPageId = "default"
strPathNoFileName = "http://SERVERNAME/DIRECTORY"
Else
strPageId = fi.Name.Replace(fi.Extension, "") 'without extension
strPathNoFileName = strPagePath.Replace(fi.Name, "")
'Assign dynamic page paths
strXMLPath_mc = strPathNoFileName + "docs/xml/" & strPageId & ".xml" 'xml doc
strXSLPath_mc = strPathNoFileName + "docs/xslt/" & strPageId & ".xsl" 'xsl doc
strCSSPath = strPathNoFileName + "docs/css/" & strPageId & ".css" 'css doc
End If
...which resulted in the following:
strFullPagePath: \\SERVERNAME\DIRECTORY\SUBDIRECTORY\PAGE.aspx
strXMLPath_mc: /DIRECTORY/docs/xml/DEFAULTPAGE.xml
strXSLPath_mc: /DIRECTORY/docs/xslt/DEFAULTPAGE.xsl
strCSSPath: /DIRECTORY/docs/css/DEFAULTPAGE.css
Each individual file uses the MasterPage to pull up the page's content using a XML/XSLT transformation on-the-fly. The MasterPage loads a central XML doc that contains all of the site's page properties, and pulls only the nodes where the page's id matches the "id" node within that central XML doc.
Current Status
Here's some good news. I removed the If Not fi.Exists...Else statement to see if the requested ASP.NET page would load, and it actually did. This is what the code looks like:
Code:
'Check if files exist
'If Not fi.Exists Then
'strPageId = "default"
'strPathNoFileName = "http://SERVERNAME/DIRECTORY"
'Else
strPageId = fi.Name.Replace(fi.Extension, "") 'without extension
strPathNoFileName = strPagePath.Replace(fi.Name, "")
'Assign dynamic page paths
strXMLPath_mc = strPathNoFileName + "docs/xml/" & strPageId & ".xml" 'xml doc
strXSLPath_mc = strPathNoFileName + "docs/xslt/" & strPageId & ".xsl" 'xsl doc
strCSSPath = strPathNoFileName + "docs/css/" & strPageId & ".css" 'css doc
'End If
...which resulted in the following:
strFullPagePath: \\SERVERNAME\DIRECTORY\SUBDIRECTORY\PAGE.aspx
strXMLPath_mc: /DIRECTORY/SUBDIRECTORY/docs/xml/PAGE.xml
strXSLPath_mc: /DIRECTORY/SUBDIRECTORY/docs/xslt/PAGE.xsl
strCSSPath: /DIRECTORY/SUBDIRECTORY/docs/css/PAGE.css
It's able to manipulate the file path using this class, but it can't see that the file actually exists.
I really like that I can check to see if the file exists, and redirect the user to a default page if it does not. So I'm not sure how I can accomplish that with my current setup. If you could help me out with that, that would be great.
These are the two ways I've tried to pull the requested file from the site for the FileInfo Class:
Dim strFullPagePath = "\\SERVERNAME\DIRECTORY\SUBDIRECTORY\PAGE.aspx "
Dim strFullPagePath = "z:\SERVERNAME\DIRECTORY\SUBDIRECTORY\PAGE.asp x"
I hope my clarification helps to answer your questions. Let me know if it doesn't, or if you have others. And thanks again for your help.
KWilliams