M
mqsash
Hi
I have written a simple C# Class Assembly.
Normally it works fine, but when I write some code (in the ctor) which
tries to reference the System.Web, then the CTOR does not get invoked
at all !!
The code is as shown below.
-------------------------------------------------------------------
1. using System;
2. using System.Web;
3. using System.Windows.Forms;
4.
5. namespace testAssembly
6. {
7. public class Class1
8. {
9. public Class1()
10. {
11. string URL ="Blank";
12. MessageBox.Show("ctor");
13. URL = "test";
14. MessageBox.Show(URL);
15. }
16. }
17. }
-------------------------------------------------------------------
The assembly is embedded into the following html
<html> <body >
<OBJECT ID="myAssembly"
classid="testAssembly.dll#testAssembly.Class1"></OBJECT>
This is a testAssembly
</body> </html>
When I open this html, everything works as expected.
1. The assembly's constructor is invoked,
2. I get a MessageBox with the "ctor" message. (Line #12)
3. I then get the next MessageBox with the "test" message (Line #14)
NOW if I try to access something under System.Web ( Line #13 ).......
13. URL = System.Web.HttpContext.Current.Request.RawUrl;;
The expected behaviour is that after the "ctor" message, I should get
the current url in a MessageBox (Line #14).
BUT I do not even get the "ctor" message !! Seems like even the
constructor is not invoked !
I have added reference to the System.Web.dll so that should not be a
problem.
Can anybody shed some light over here ? What might be causing this ?
TIA
mqs
I have written a simple C# Class Assembly.
Normally it works fine, but when I write some code (in the ctor) which
tries to reference the System.Web, then the CTOR does not get invoked
at all !!
The code is as shown below.
-------------------------------------------------------------------
1. using System;
2. using System.Web;
3. using System.Windows.Forms;
4.
5. namespace testAssembly
6. {
7. public class Class1
8. {
9. public Class1()
10. {
11. string URL ="Blank";
12. MessageBox.Show("ctor");
13. URL = "test";
14. MessageBox.Show(URL);
15. }
16. }
17. }
-------------------------------------------------------------------
The assembly is embedded into the following html
<html> <body >
<OBJECT ID="myAssembly"
classid="testAssembly.dll#testAssembly.Class1"></OBJECT>
This is a testAssembly
</body> </html>
When I open this html, everything works as expected.
1. The assembly's constructor is invoked,
2. I get a MessageBox with the "ctor" message. (Line #12)
3. I then get the next MessageBox with the "test" message (Line #14)
NOW if I try to access something under System.Web ( Line #13 ).......
13. URL = System.Web.HttpContext.Current.Request.RawUrl;;
The expected behaviour is that after the "ctor" message, I should get
the current url in a MessageBox (Line #14).
BUT I do not even get the "ctor" message !! Seems like even the
constructor is not invoked !
I have added reference to the System.Web.dll so that should not be a
problem.
Can anybody shed some light over here ? What might be causing this ?
TIA
mqs