Object Required Error

A

Apostolis K.

At first I make a independend virtual directory wich I named app and I check
Directory Browsing in the Virtual Directory Properties. Then I create with
notepad global.asa and index.asp

global.asa
<OBJECT ID="objMyInfo" RUNAT="server" SCOPE="Application"
PROGID="MSWC.MYInfo"></OBJECT>
<SCRIPT Language="VBScript" RUNAT="server">
Sub Application_onStart()
objMyInfo.vDailyBanner="The Big News Today is..."
Dim vMyVar
vMyVar="Some text stored in the Application"
Application("storedtext")=vMyVar
End Sub
</SCRIPT>


index.htm
<HTML>
<HEAD><TITLE>Showing Application Variables</TITLE>/HEAD>
<BODY>
<H2>The Daily Banner Headlines</H2>
<%
objMyInfo.vDailyBanner="My Personal News is"
vDayBan=objMyInfo.vDailyBanner
Response.Write(vDayBan)&":"
vMVr=Application.Contents("storedtext")
Response.Write(vMVr)&"<BR>"
%>
</BODY>
</HTML>

I browse into the directory with Internet Explorer and I click index.asp.
Unfortunately I get the following error.

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/app/index.asp, line 6



I am an ASP Begginer. I wrote all these based into an ASP Begginers book.
I tried lots of times and can't get what is wrong.
I hope you can help me.


PS1: My platform information is: Windows XP Pro, IIS 5.1, IE6
 
A

Aaron Bertrand [MVP]

I browse into the directory with Internet Explorer and I click index.asp.

First of all, don't do that. To run an ASP page, you *TYPE* the URL into
the browser, e.g. http://localhost/index.asp
objMyInfo.vDailyBanner="The Big News Today is..."

Can you explain why you think you need the MyInfo component to store text in
application scope?
PS1: My platform information is: Windows XP Pro, IIS 5.1, IE6

Also, from http://www.aspfaq.com/2413, which describes this error:

Active Server Pages, ASP 0134 (0x80004005)
The object has an invalid ProgID of 'MSWC.MyInfo'

"This can happen if you try to use the default global.asa that ships with
IIS 5.1 on Windows XP. XP doesn't ship with the MSWC.MyInfo object by
default, so the best solution is to rename the global.asa so it stops
causing problems. In the default web root, you really don't need a
global.asa anyway... and if you do, it should be a lot more barebones than
that one. "
 
A

Apostolis K.

First of all, don't do that. To run an ASP page, you *TYPE* the URL into

Ok I type the URL directly but the result is the same


objMyInfo.vDailyBanner="The Big News Today is..."
Can you explain why you think you need the MyInfo component to store text
in application scope?

I have no idea. The book sais so. The idea is to show how to retrieve data
and variables from global.asa and it was supposed to work



"This can happen if you try to use the default global.asa that ships with
IIS 5.1 on Windows XP. XP doesn't ship with the MSWC.MyInfo object by
default, so the best solution is to rename the global.asa so it stops
causing problems. In the default web root, you really don't need a
global.asa anyway... and if you do, it should be a lot more barebones than
that one. "

There is not a global.asa inside the default web root. However do I have to
put my own global.asa to the default web root in order to work?
 
A

Aaron Bertrand [MVP]

Scrap the stupid MyInfo code.

Global.asa:

<script language=vbscript runat=server>
sub application_onstart
application("foo") = "splunge"
end sub
</script>

Any ASP page within the same site/application folder:

<%=application("foo")%>

If this doesn't work, see

No offense to ASP authors who may be lurking, but ASP books are typically
the worst place to learn how to code in ASP (this includes the ASP books to
which I've contributed). They are almost exclusively comprised of
inefficient and/or non-working examples that demonstrate superfluous,
non-realistic and non-real-world scenarios.

Better to peruse some web sites, where you might not always escape the
above, but you'll find some good examples as well -- and they won't all be
obsolete. Here are some starting points:

http://www.aspfaq.com/2183
 

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,780
Messages
2,569,611
Members
45,270
Latest member
TopCryptoTwitterChannels_

Latest Threads

Top