.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 29th, 2008, 11:50 AM
canarchy canarchy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 15 canarchy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 44 sec
Reputation Power: 0
Angry ASP.Net/General - ASP to ASP.NET error

I am trying to convert an asp listing script into an asp.net page. I already eliminated the SET and LET keys but i get this error.


Code:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

 Compiler Error Message: BC30451: Name 'objCollection' is not declared.

Source Error:

Line 99: ' output the folder list
Line 100:''''''''''''''''''''''''''''''''''''''''
Line 101:objCollection = objFolder.SubFolders
Line 102:For Each objItem in objCollection
Line 103:strName = objItem.Name

on


Any Help? Thanks.

Reply With Quote
  #2  
Old May 5th, 2008, 08:20 AM
jmurrayhead's Avatar
jmurrayhead jmurrayhead is offline
The Drunken Moderator
ASP Free God 17th Plane (13000 - 13499 posts)
 
Join Date: Feb 2004
Location: Reston, VA, USA
Posts: 13,030 jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate Folder
Time spent in forums: 3 Months 5 Days 8 h 41 m 20 sec
Reputation Power: 1563
Facebook
Did you declare objCollection? The error is pretty obvious.
__________________
jmurrayhead

Did I help you out? Make me popular by clicking the icon!

New Members:Proper way to post a question

Powered by ASP.Net

Reply With Quote
  #3  
Old May 5th, 2008, 09:13 PM
canarchy canarchy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 15 canarchy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 44 sec
Reputation Power: 0
So i messed with it and fixed the dim problem (i had declared objcollection, no idea why that hadn't worked) now its giving me this error... weird stuff

Quote:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'objFolder.SubFolders' is not defined.

Source Error:

Line 103:'Dim objcollection As objFolder.Subfolders
Line 104:
Line 105im objCollection = New objFolder.SubFolders
Line 106:For Each objItem in objCollection
Line 107:strName = objItem.Name


Source File: E:\Kenn\districtart\gallery\high\list.aspx Line: 105


Entire Source Code: Sorry Its so Long...
Code:
<%@ Page Language="VB" MasterPageFile="/districtart/master/MasterPage.master" AutoEventWireup="false" title="CRCSD Test Page" %>


<asp:Content ID="content3" ContentPlaceHolderID="prehead" Runat="Server">
<%

On Error Resume Next

' declare variables
Dim objFSO, objFolder
Dim objCollection, objItem
Dim strPhysicalPath, strTitle, strServerName
Dim strPath, strTemp, foldName, foldTemp
Dim strName, strFile, strExt, strAttr, strDisplay
Dim intSizeB, intSizeK, intAttr, dtmDate





' get the current folder URL path
strTemp = Mid(Request.ServerVariables("URL"),2)
strPath = ""
Do While Instr(strTemp,"/")
foldTemp = Left(strTemp,Instr(strTemp,"/"))
strPath = strPath & Left(strTemp,Instr(strTemp,"/"))
strTemp = Mid(strTemp,Instr(strTemp,"/")+1)
Loop
foldName = Right(foldTemp,Instr(foldTemp,"/"))
foldName = Left(foldName,Len(foldName)-1)
strPath = "/" & strPath


' build the page title
strServerName = UCase(Request.ServerVariables("SERVER_NAME"))
strTitle = "Contents of the " & foldName & " folder"


' create the file system objects
strPhysicalPath = Server.MapPath(strPath)
objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFolder = objFSO.GetFolder(strPhysicalPath)
%>


</asp:Content>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style18
        {
            width: 100%;
        }
        .style19
        {
            width: 396px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CurrentGallery" runat="server">
<table border="0" width="775" cellspacing="0" cellpadding="0">

       <tr>
    
    <td width="706" valign="top" style="border-style: solid; border-color:#000000; border-width: 1">
       <table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
      
       <td align="center"><!--#include virtual="/gallery/artgallery/menu.asp"-->
       <br> Albums are organized by school year. 
    
       </td>
       </tr>
    
       <tr>
       <td align="center">
        
       <script>
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,men  ubar=0,resizable=0,width=780,height=550,left = 0,top = 0');");
}
// End -->
</script><div align="left">
<table border="0" cellspacing="0" width="600">
<tr>

<td width="526">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
<td valign="top" align="left">
<div align="center"><br>
<table width="200" border="0" cellspacing="0" cellpadding="5">
<%


''''''''''''''''''''''''''''''''''''''''
' output the folder list
''''''''''''''''''''''''''''''''''''''''
'Dim objcollection As objFolder.Subfolders

Dim objCollection = New objFolder.SubFolders
For Each objItem in objCollection
strName = objItem.Name
strAttr = MakeAttr(objItem.Attributes)
dtmDate = CDate(objItem.DateLastModified)
%>
<% If (Left(strName,1) <> "_") AND (strName <> "Default") then %>
<tr>

<td align="left">




<a href="javascript:popUp('<%=strName%>/index.htm')" class="black"><%=strName%></a></td>
</tr>
<% end if%>
<% Next %>
<tr>
<td width="275">

</td>
</tr>
</table> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>


        
   </td></tr>

</table>
       </td>
       </tr>
       </table>
</asp:Content>


This worked with a regular asp page... am i going to have to go back to that? I'd rather not as my master page uses alot of asp.net stuff that i don't want to recreate in asp before my deadline on this project.

Reply With Quote
  #4  
Old May 6th, 2008, 07:48 AM
jmurrayhead's Avatar
jmurrayhead jmurrayhead is offline
The Drunken Moderator
ASP Free God 17th Plane (13000 - 13499 posts)
 
Join Date: Feb 2004
Location: Reston, VA, USA
Posts: 13,030 jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate Folder
Time spent in forums: 3 Months 5 Days 8 h 41 m 20 sec
Reputation Power: 1563
Facebook
It looks like you're trying to list files and folders on the server. Have a look at this snippet: http://aspnet101.com/aspnet101/tutorials.aspx?id=12

Keep in mind the major differences between classic ASP and ASP.Net. It's not always easy to convert and there is usually a better way to handle things in ASP.Net than there is in classic ASP.

Reply With Quote
  #5  
Old May 6th, 2008, 07:57 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,621 Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 13 h 47 m 29 sec
Reputation Power: 1441
you have long way ahead of you, canarchy.. judging from your current
code you don't have the required .NET skills - yet.
I would advice you to spend as much time as you need in learning the
basics of .NET and the syntax of VB.NET and only then get back
to your code.

Reply With Quote
  #6  
Old May 6th, 2008, 08:31 AM
canarchy canarchy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 15 canarchy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 44 sec
Reputation Power: 0
Thanks for the help so far, i added the line
Code:
<%@ Import Namespace="System.IO" %> 
to my master page and the tutorial gives me the same errors. Is it me or something im going to need to request a change on the server?

Reply With Quote
  #7  
Old May 6th, 2008, 08:40 AM
Wolffy's Avatar
Wolffy Wolffy is offline
Slaprentice of Wolves
Click here for more information.
 
Join Date: Aug 2007
Location: Mossville, IL
Posts: 1,246 Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Wolffy User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 19 h 54 m 25 sec
Reputation Power: 423
Are you saying this code came from a Tutorial? If so, abandon that tutorial now!. It looks like you are trying to code ASP.NET while your classic ASP glasses are still on. It is quite unusual to plop code in the middle of a page like this is ASP.NET.
__________________
Wolffy
------------------------
Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. Not FDIC insured

Reply With Quote
  #8  
Old May 6th, 2008, 08:55 AM
canarchy canarchy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 15 canarchy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 44 sec
Reputation Power: 0
So I fixed it by going to regular asp and using the following code.


Before the HTML tag:
Code:
<%
Option Explicit
On Error Resume Next

' declare variables
Dim objFSO, objFolder
Dim objCollection, objItem
Dim strPhysicalPath, strTitle, strServerName
Dim strPath, strTemp, foldName, foldTemp
Dim strName, strFile, strExt, strAttr, strDisplay
Dim intSizeB, intSizeK, intAttr, dtmDate


' don't cache the page
Response.AddHeader "Pragma", "No-Cache"
Response.CacheControl = "Private"


' get the current folder URL path
strTemp = Mid(Request.ServerVariables("URL"),2)
strPath = ""
Do While Instr(strTemp,"/")
foldTemp = Left(strTemp,Instr(strTemp,"/"))
strPath = strPath & Left(strTemp,Instr(strTemp,"/"))
strTemp = Mid(strTemp,Instr(strTemp,"/")+1)
Loop
foldName = Right(foldTemp,Instr(foldTemp,"/"))
foldName = Left(foldName,Len(foldName)-1)
strPath = "/" & strPath


' build the page title
strServerName = UCase(Request.ServerVariables("SERVER_NAME"))
strTitle = "Contents of the " & foldName & " folder"


' create the file system objects
strPhysicalPath = Server.MapPath(strPath)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPhysicalPath)
%>


In the body.
Code:
<!-- Heres hte crap -->
									   
									   
									   
                                       <table border="0" cellspacing="0" cellpadding="0" align="center">

       
    <td valign="top" style="border-style: solid; border-color:#000000; border-width: 1">
       <table border="0" cellspacing="0" cellpadding="0">
<tr>
      
       <td align="center"><!--#include virtual="/gallery/artgallery/menu.asp"-->
       <br> Albums are organized by school year. 
    
       </td>
       </tr>
    
       <tr>
       <td align="center">
        
       <script>
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,men  ubar=0,resizable=0,width=780,height=550,left = 0,top = 0');");

}</style>
// End -->
</script><div align="left">

<table border="0" cellspacing="0">
<tr>

<td width="526">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
<td valign="top" align="left">
<div align="center"><br>
<table width="200" border="0" cellspacing="0" cellpadding="5">
<%


''''''''''''''''''''''''''''''''''''''''
' output the folder list
''''''''''''''''''''''''''''''''''''''''
Set objCollection = objFolder.SubFolders
For Each objItem in objCollection
strName = objItem.Name
strAttr = MakeAttr(objItem.Attributes)
dtmDate = CDate(objItem.DateLastModified)
%>
<% If (Left(strName,1) <> "_") AND (strName <> "Default") then %>
<tr>

<td align="left">




<a href="javascript:popUp('<%=strName%>/index.htm')" class="black"><%=strName%></a></td>
</tr>
<% end if%>
<% Next %>
<tr>
<td width="275">

</td>
</tr>
</table> </div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>


        
   </td></tr>

</table>
       </td>
       </tr>
       </table>
                                        
                                       
                                       
                                  </td>
                                </tr></table>

Reply With Quote
  #9  
Old May 6th, 2008, 08:57 AM
jmurrayhead's Avatar
jmurrayhead jmurrayhead is offline
The Drunken Moderator
ASP Free God 17th Plane (13000 - 13499 posts)
 
Join Date: Feb 2004
Location: Reston, VA, USA
Posts: 13,030 jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate Folder
Time spent in forums: 3 Months 5 Days 8 h 41 m 20 sec
Reputation Power: 1563
Facebook
I wouldn't consider that "fixing" it. Sure, it does what you want it to, but you had to resort to Classic ASP in an ASP.Net environment.

Reply With Quote
  #10  
Old May 6th, 2008, 04:37 PM
canarchy canarchy is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 15 canarchy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 44 sec
Reputation Power: 0
I am still trying to make the .net page work, but as long as that is not working i am going to use this page. My main question it seems is: how do i define a type?

The error seems strait forward enough...

Reply With Quote
  #11  
Old May 6th, 2008, 04:55 PM
jmurrayhead's Avatar
jmurrayhead jmurrayhead is offline
The Drunken Moderator
ASP Free God 17th Plane (13000 - 13499 posts)
 
Join Date: Feb 2004
Location: Reston, VA, USA
Posts: 13,030 jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)jmurrayhead User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate FolderFolding Points: 79068 Folding Title: Intermediate Folder
Time spent in forums: 3 Months 5 Days 8 h 41 m 20 sec
Reputation Power: 1563
Facebook
This error means that the compiler does not recognise 'objFolder.SubFolders'. Either it does not exist or the proper namespace hasn't been imported. There are several examples online on how to do this the .Net way, however, I would take the suggestion given regarding learning the basics.

Reply With Quote
  #12  
Old May 6th, 2008, 04:59 PM