Using DLL in ASPX

R

rn5a

Using VBC, I compiled a VB class file into a DLL named MyPro.dll. The
namespace used in this class file is 'MyPro' & the public class is
named 'MyClass'. This is the ASPX page which imports the namespace &
instantiates the class 'MyClass' so that the ASPX code can invoke the
different functions existing within the class 'MyClass':

<%@ Import Namespace="MyPro" %>

<script runat="server">
Public boMyClass As MyClass

Sub Page_Load(....)
boMyClass = New MyClass
...............
...............
End Sub

Sub MySub(....)
boMyClass = New MyClass
...............
...............
End Sub
</script>

Now what I find is though the above ASPX code works fine, on quite a
few occasions, when I make some changes in the ASPX page (not in the
class file) & then re-run the ASPX page in IE, ASP.NET generates the
error:

Name 'boMyClass' is not declared.

pointing to the line

Public boMyClass As MyClass

This forces me to compile the class (using VBC) again & again after
which only the ASPX page runs fine. Note that I didn't make any changes
in the class file (had I done that, then the class file, of course,
ought to be compiled each time any changes are made). I made changes
only in the ASPX page.

Can someone please tell me why am I encountering this error
intermittently?
 
R

rn5a

Sloan, one clarification.....the error ASP.NET generates is

Type 'MyClass' is not defined.

& not the one that I mentioned in post #1. Sorry for the wrong
information.

Why isn't the object persisting page to page or on a postback? What
could the reason be?

I tried navigating to the link you cited in your post but I don't know
why IE always generates an error (asking me if I want to send the error
to MS) & then that IE window closes automatically. As far as using
Session objects are concerned, that would be my last option but I am
sure there must be some way out. I am keen to know the reason behind
the error.

I have been working with ASP.NET for quite some time now & this is the
first time I am encountering such an error. Any other ideas?

I use Visual Web Developer 2005 Express Edition to create & edit
ASP.NET related files.

The object does not persist page to page (or on a "postback")... therefore
you'll need to store the object somewhere to reuse it.

..

See
http://sholliday.spaces.live.com/blog/ 10/24/2005 entry

It has a object holder for asp.net.

Or you can use the Session["key"] object.


Using VBC, I compiled a VB class file into a DLL named MyPro.dll. The
namespace used in this class file is 'MyPro' & the public class is
named 'MyClass'. This is the ASPX page which imports the namespace &
instantiates the class 'MyClass' so that the ASPX code can invoke the
different functions existing within the class 'MyClass':

<%@ Import Namespace="MyPro" %>

<script runat="server">
Public boMyClass As MyClass

Sub Page_Load(....)
boMyClass = New MyClass
...............
...............
End Sub

Sub MySub(....)
boMyClass = New MyClass
...............
...............
End Sub
</script>

Now what I find is though the above ASPX code works fine, on quite a
few occasions, when I make some changes in the ASPX page (not in the
class file) & then re-run the ASPX page in IE, ASP.NET generates the
error:

Name 'boMyClass' is not declared.

pointing to the line

Public boMyClass As MyClass

This forces me to compile the class (using VBC) again & again after
which only the ASPX page runs fine. Note that I didn't make any changes
in the class file (had I done that, then the class file, of course,
ought to be compiled each time any changes are made). I made changes
only in the ASPX page.

Can someone please tell me why am I encountering this error
intermittently?
 
S

sloan

Why isn't the object persisting page to page or on a postback? What
could the reason be?

Its not suppossed to. The web environment is a stateless one. unless you
use some of objects used to work (around) the statelessness.

.....

Use another browser besides IE. (firefox). The August update patch for IE,
.... kills msn sites. I'm not sure why MS doesn't get it fixed.
Sorry, but the issue is with IE, so not much I can do for you there.

...


Sloan, one clarification.....the error ASP.NET generates is

Type 'MyClass' is not defined.

& not the one that I mentioned in post #1. Sorry for the wrong
information.

Why isn't the object persisting page to page or on a postback? What
could the reason be?

I tried navigating to the link you cited in your post but I don't know
why IE always generates an error (asking me if I want to send the error
to MS) & then that IE window closes automatically. As far as using
Session objects are concerned, that would be my last option but I am
sure there must be some way out. I am keen to know the reason behind
the error.

I have been working with ASP.NET for quite some time now & this is the
first time I am encountering such an error. Any other ideas?

I use Visual Web Developer 2005 Express Edition to create & edit
ASP.NET related files.

The object does not persist page to page (or on a "postback")... therefore
you'll need to store the object somewhere to reuse it.

..

See
http://sholliday.spaces.live.com/blog/ 10/24/2005 entry

It has a object holder for asp.net.

Or you can use the Session["key"] object.


Using VBC, I compiled a VB class file into a DLL named MyPro.dll. The
namespace used in this class file is 'MyPro' & the public class is
named 'MyClass'. This is the ASPX page which imports the namespace &
instantiates the class 'MyClass' so that the ASPX code can invoke the
different functions existing within the class 'MyClass':

<%@ Import Namespace="MyPro" %>

<script runat="server">
Public boMyClass As MyClass

Sub Page_Load(....)
boMyClass = New MyClass
...............
...............
End Sub

Sub MySub(....)
boMyClass = New MyClass
...............
...............
End Sub
</script>

Now what I find is though the above ASPX code works fine, on quite a
few occasions, when I make some changes in the ASPX page (not in the
class file) & then re-run the ASPX page in IE, ASP.NET generates the
error:

Name 'boMyClass' is not declared.

pointing to the line

Public boMyClass As MyClass

This forces me to compile the class (using VBC) again & again after
which only the ASPX page runs fine. Note that I didn't make any changes
in the class file (had I done that, then the class file, of course,
ought to be compiled each time any changes are made). I made changes
only in the ASPX page.

Can someone please tell me why am I encountering this error
intermittently?
 
R

rn5a

But, as already pointed out in post #3, today is the first time I am
experiencing this error. Never before have I encountered this error
though I have been using IE 6.0 only to test ASPX pages.

Moreover, since I am working on my local Intranet (IIS 5.0 on Win 2K
Pro), I can compile the DLL again & again whenever I encounter the
error but if I upload it on the WWW, say, www.rn5a.com, then what do
users do when they encounter this error? First of all, they won't be
able to compile it again & again since they don't know where the server
exists but, by any chance, even if they get the server & other details
(& know the VBC command to compile the class file into a DLL!), I can't
expect them to do the recompiling again & again. Other than using some
object to persist, isn't there any other way to ensure that this error
doesn't turn up?

Lastly, I discovered that recompiling the DLL using VBC doesn't always
resolve the issue & the error still gets generated. Under such
circumstances, I have to save the ASPX again (even though I haven't
made any changes to it).

Have you experienced this problem anytime? If yes, did it come up
often?

Why isn't the object persisting page to page or on a postback? What
could the reason be?

Its not suppossed to. The web environment is a stateless one. unless you
use some of objects used to work (around) the statelessness.

....

Use another browser besides IE. (firefox). The August update patch for IE,
... kills msn sites. I'm not sure why MS doesn't get it fixed.
Sorry, but the issue is with IE, so not much I can do for you there.

..


Sloan, one clarification.....the error ASP.NET generates is

Type 'MyClass' is not defined.

& not the one that I mentioned in post #1. Sorry for the wrong
information.

Why isn't the object persisting page to page or on a postback? What
could the reason be?

I tried navigating to the link you cited in your post but I don't know
why IE always generates an error (asking me if I want to send the error
to MS) & then that IE window closes automatically. As far as using
Session objects are concerned, that would be my last option but I am
sure there must be some way out. I am keen to know the reason behind
the error.

I have been working with ASP.NET for quite some time now & this is the
first time I am encountering such an error. Any other ideas?

I use Visual Web Developer 2005 Express Edition to create & edit
ASP.NET related files.

The object does not persist page to page (or on a "postback")... therefore
you'll need to store the object somewhere to reuse it.

..

See
http://sholliday.spaces.live.com/blog/ 10/24/2005 entry

It has a object holder for asp.net.

Or you can use the Session["key"] object.


Using VBC, I compiled a VB class file into a DLL named MyPro.dll. The
namespace used in this class file is 'MyPro' & the public class is
named 'MyClass'. This is the ASPX page which imports the namespace &
instantiates the class 'MyClass' so that the ASPX code can invoke the
different functions existing within the class 'MyClass':

<%@ Import Namespace="MyPro" %>

<script runat="server">
Public boMyClass As MyClass

Sub Page_Load(....)
boMyClass = New MyClass
...............
...............
End Sub

Sub MySub(....)
boMyClass = New MyClass
...............
...............
End Sub
</script>

Now what I find is though the above ASPX code works fine, on quite a
few occasions, when I make some changes in the ASPX page (not in the
class file) & then re-run the ASPX page in IE, ASP.NET generates the
error:

Name 'boMyClass' is not declared.

pointing to the line

Public boMyClass As MyClass

This forces me to compile the class (using VBC) again & again after
which only the ASPX page runs fine. Note that I didn't make any changes
in the class file (had I done that, then the class file, of course,
ought to be compiled each time any changes are made). I made changes
only in the ASPX page.

Can someone please tell me why am I encountering this error
intermittently?
 

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

Top