Showing posts with label running. Show all posts
Showing posts with label running. Show all posts

Saturday, March 31, 2012

system.enterpriseservices.dll error

I am running a web app on w2k3/IIS 6.0/ASP.net 2.0. This app runs fine on a different server. The error message I get is

Compiler Error Message:CS0006: Metadata file 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll' could not be found

I have seen solutions to remove the "<identity impersonate="true" />" setting from the web.config file. That has not been helpful. Another solution was to delete the system.enterpriseservices.dll from C:\Windows\assembly. I have deleted the file, copied a new .dll, and that did not work. I have reinstalled IIS and ASP.Net 2.0 as well. So far, no dice. Any other ideas are greatly welcomed!


AJ

Hello AJ,

This may be a dumb question, but is the assembly in the GAC on the deployment server? If it isn't, you should be able to add it by running "gacutil /if System.EnterpriseServices.dll" using the 2.0 version of gacutil.exe.

HTH,
Clay


Clay,

Thanks for the response. I just got the problem figured out today.

The file permissions were screwed up. Users did not have read and execute permissions to this folder:
C:\WINDOWS\WinSxS\x86_System.EnterpriseServices_b03f5f7f11d50a3a_2.0.0.0_x-ww_7d5f3790

After I fixed that I got a similar error message as before but it mentioned a system.enterpriseServices.Wrapper.dll and found out that this file was missing
C:\WINDOWS\WinSxS\x86_System.EnterpriseServices_b03f5f7f11d50a3a_2.0.0.0_x-ww_7d5f3790\System.EnterpriseServices.Wrapper.dll

Now it is running like a champ!

AJ

Wednesday, March 28, 2012

System.IO.File class and IP paths?

I try to use System.IO.File.Copy where the source is
"\\10.100.100.1\myfolder\test.txt"

When running the aspx file on the server (the server is
also the client) it works, but when using another NT
client it does not work.
The err.description says "Could not find file ..."
System.IO.File.Exists return false here.

But If I manually paste in \\10.100.100.1
\myfolder\test.txt in the IE address field and press "Go"
the file is found.

Strange or not?Hi,

I don't think that the default asp.net user got rights to access network
resources.

Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Monday, March 26, 2012

system.net.mail email tagged as spam!

Hi - I have a small room booking application running, where people logon, and book a room. THey should then get an email confirmation, sent directly from my web app (vb.net - .net2), which uses the system.net.mail class. However, I'm getting more and more people reporting they have not received the confirmation, and most recently, someone advising SPAMASSASSIN reported my email as being spam!

I'm not sure how this happens - as it's a request from someone for a booking, and all I'm doing is replying to their supplied email address, through my web app.

Is there some way I can add an identifier, to 'legitimise' my email?

Before asking, no, I'm not a spammer - I've posted several queries here over the last few years, and am a genuine developer - with a new problem to try and overcome.

Thanks for any help/pointers,

Mark

Im not sure of any ways to legitimize your messages, maybe its because of keywords that you are using in your subject line or body that is causing it to be filtered as spam, or maybe it is the web address you are sending it from.

Usually a subject line is a dead give away of spam though and many programs search for keywords in the subject and body to try to Identify spam, im sure if you search around on google you can find a keyword list and try to improve the context of your messages.

If that doesnt work then i am sorry i cant be much more help.

good luck :)


I'd try to contact SPAMASSASSIN or other anti-spam companies with your problem. I know of 1 other companies, Postini (http://www.postini.com/) which does anti-spam filtering for corporate email systems.


Hi - thanks for the suggestions so far - I will follow up where possible.

In the meantime, I read this (from a link on SPAMASSASSINS website):

"If your message is in HTML,DO include all of the MIME message headers that identify it as HTML. (You'd think this would be obvious, but mailers from the NY Times to Air Canada send HTML messages missing the mime-version header.)" fromhttp://spam.abuse.net/marketerhelp/bulk-howto.shtml

I'm not advocating it, as I'm not certain if it's trying to help, or tell you how to spam - but how from the system.net.mail webspace, how do you include MIME headers, and what should they contain?

Thanks, Mark


I've really done something on anti-spam research before.. Based on my understanding, i don't think it has anything to do with the "MIMI" message(note my suggestion could be WRONG).

i think in your case, the reason probably is that there are some not welcomed words exist in your mail thus cause your email recognized as a spam. So, maybe youshould first check the content of your mail(send the same email using another account like..yahoo..gmail..etc, and see if it's still recognized as spam)

Hope my suggestion helps


Hi BC - thanks.

Do you mean send to a GMAIL/Yahoo email address, or send from one - are there any programs which you can send some html to, to hilight the problem areas?

Thanks, Mark


and most recently, someone advising SPAMASSASSIN reported my email as being spam!

If you can still contact this "someone", send him/her the same confirmation email FROM a yahoo/hotmial/gmail account and see if it's still recognized as a spam. thanks

Thursday, March 22, 2012

System.OutOfMemoryException

Hi,
We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory error.
The computer has enough memory, in fact, when the error takes place there
are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often, so,
we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB of
physical memory available?
Thank you very much,
Any guidance will be appreciated.A common source of memory problems is not closing database connections.
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...
> Hi,
> We have an application using .NET framework 1.1 and SQL Server 2000. The
> application seems to be running very well until we get an OutOfMemory
> error. The computer has enough memory, in fact, when the error takes place
> there are 2 GB available in physical memory.
> Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
> before recycling.This made the session information be lost quite often,
> so, we decided to increase the limitation to 3GB and then, we got the
> OutOfMemory error, although our server has 8GB of physical memory and only
> 3GB is used by SQL Server. Now we have the Maximum used memory (in
> megabytes) to 2100.
> Do you have any clue about why we have memory problems when there are 2GB
> of physical memory available?
> Thank you very much,
> Any guidance will be appreciated.
>
unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max you
can set the memory to.
-- bruce (sqlwork.com)
"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...
> Hi,
> We have an application using .NET framework 1.1 and SQL Server 2000. The
> application seems to be running very well until we get an OutOfMemory
> error. The computer has enough memory, in fact, when the error takes place
> there are 2 GB available in physical memory.
> Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
> before recycling.This made the session information be lost quite often,
> so, we decided to increase the limitation to 3GB and then, we got the
> OutOfMemory error, although our server has 8GB of physical memory and only
> 3GB is used by SQL Server. Now we have the Maximum used memory (in
> megabytes) to 2100.
> Do you have any clue about why we have memory problems when there are 2GB
> of physical memory available?
> Thank you very much,
> Any guidance will be appreciated.
>
Thank you very much for your help. I have the /3GB in our boot.ini file:
[boot loader]
redirect=UseBiosSettings
timeout=30
default=multi(0)disk(0)rdisk(0)partition
(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WIND
OWS="Windows Server 2003, Enterprise
3GB" /fastdetect /3GB /PAE /redirect /NoExecute=OptOut
Are there anything else we can do in order w3wp.exe to be able to use more
than 2 GB?
Thanks a lot.
"bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com>
escribi en el mensaje news:%237F$M4ZCHHA.5012@.TK2MSFTNGP06.phx.gbl...
> unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max
> you can set the memory to.
> -- bruce (sqlwork.com)
> "Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote in message
> news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...
>
Are you doing any work like dynamically generating images using GDI?
If so you might want to make sure that the code cleans up after itself
correctly or your server memory will go through the roof!
On Thu, 16 Nov 2006 08:16:08 +0100, "Carmen"
<quitaresto@.cpachecoe@.fcc.es@.quitaresto> wrote:

>Hi,
>We have an application using .NET framework 1.1 and SQL Server 2000. The
>application seems to be running very well until we get an OutOfMemory error
.
>The computer has enough memory, in fact, when the error takes place there
>are 2 GB available in physical memory.
>Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
>before recycling.This made the session information be lost quite often, so,
>we decided to increase the limitation to 3GB and then, we got the
>OutOfMemory error, although our server has 8GB of physical memory and only
>3GB is used by SQL Server. Now we have the Maximum used memory (in
>megabytes) to 2100.
>Do you have any clue about why we have memory problems when there are 2GB o
f
>physical memory available?
>Thank you very much,
>Any guidance will be appreciated.
>
--
Bits.Bytes.
http://bytes.thinkersroom.com

System.OutOfMemoryException

Hi,

We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory error.
The computer has enough memory, in fact, when the error takes place there
are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often, so,
we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB of
physical memory available?

Thank you very much,
Any guidance will be appreciated.A common source of memory problems is not closing database connections.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitarestowrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

Hi,
>
We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory
error. The computer has enough memory, in fact, when the error takes place
there are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often,
so, we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB
of physical memory available?
>
Thank you very much,
Any guidance will be appreciated.
>


unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max you
can set the memory to.

-- bruce (sqlwork.com)

"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitarestowrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

Hi,
>
We have an application using .NET framework 1.1 and SQL Server 2000. The
application seems to be running very well until we get an OutOfMemory
error. The computer has enough memory, in fact, when the error takes place
there are 2 GB available in physical memory.
Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
before recycling.This made the session information be lost quite often,
so, we decided to increase the limitation to 3GB and then, we got the
OutOfMemory error, although our server has 8GB of physical memory and only
3GB is used by SQL Server. Now we have the Maximum used memory (in
megabytes) to 2100.
Do you have any clue about why we have memory problems when there are 2GB
of physical memory available?
>
Thank you very much,
Any guidance will be appreciated.
>


Thank you very much for your help. I have the /3GB in our boot.ini file:

[boot loader]
redirect=UseBiosSettings
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise
3GB" /fastdetect /3GB /PAE /redirect /NoExecute=OptOut

Are there anything else we can do in order w3wp.exe to be able to use more
than 2 GB?

Thanks a lot.

"bruce barker (sqlwork.com)" <b_r_u_c_e_removeunderscores@.sqlwork.com>
escribi en el mensaje news:%237F$M4ZCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

unless your running 64 bit or 32bit with the 3gb switch, 2gb is the max
you can set the memory to.
>
-- bruce (sqlwork.com)
>
"Carmen" <quitaresto@.cpachecoe@.fcc.es@.quitarestowrote in message
news:%23OkvY8UCHHA.5012@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

>Hi,
>>
>We have an application using .NET framework 1.1 and SQL Server 2000. The
>application seems to be running very well until we get an OutOfMemory
>error. The computer has enough memory, in fact, when the error takes
>place there are 2 GB available in physical memory.
>Some days ago, we have a limitation in memory for DefaultAppPool of 1,5
>GB before recycling.This made the session information be lost quite
>often, so, we decided to increase the limitation to 3GB and then, we got
>the OutOfMemory error, although our server has 8GB of physical memory and
>only 3GB is used by SQL Server. Now we have the Maximum used memory (in
>megabytes) to 2100.
>Do you have any clue about why we have memory problems when there are 2GB
>of physical memory available?
>>
>Thank you very much,
>Any guidance will be appreciated.
>>


>
>


Are you doing any work like dynamically generating images using GDI?
If so you might want to make sure that the code cleans up after itself
correctly or your server memory will go through the roof!

On Thu, 16 Nov 2006 08:16:08 +0100, "Carmen"
<quitaresto@.cpachecoe@.fcc.es@.quitarestowrote:

Quote:

Originally Posted by

>Hi,
>
>We have an application using .NET framework 1.1 and SQL Server 2000. The
>application seems to be running very well until we get an OutOfMemory error.
>The computer has enough memory, in fact, when the error takes place there
>are 2 GB available in physical memory.
>Some days ago, we have a limitation in memory for DefaultAppPool of 1,5 GB
>before recycling.This made the session information be lost quite often, so,
>we decided to increase the limitation to 3GB and then, we got the
>OutOfMemory error, although our server has 8GB of physical memory and only
>3GB is used by SQL Server. Now we have the Maximum used memory (in
>megabytes) to 2100.
>Do you have any clue about why we have memory problems when there are 2GB of
>physical memory available?
>
>Thank you very much,
>Any guidance will be appreciated.
>


--

Bits.Bytes.
http://bytes.thinkersroom.com

System.OutofMemoryException - Session

Hi

I have an application running on a cluster that's constantly throwing an OutOfMemoryException with the following message
"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'.

In this instance, session state mode is set to 'StateServer' and the only object being stored in the session is a dataset (which is serializable)..

Anyone have any ideas

Thanks!for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!
for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!

System.OutofMemoryException - Session

Hi

I have an application running on a cluster that's constantly throwing an OutOfMemoryException with the following message
"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'.

In this instance, session state mode is set to 'StateServer' and the only object being stored in the session is a dataset (which is serializable)..

Anyone have any ideas

Thanks!for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!

System.OutofMemoryException - Session

Hi

I have an application running on a cluster that's constantly throwing an OutOfMemoryException with the following message
"Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'.

In this instance, session state mode is set to 'StateServer' and the only object being stored in the session is a dataset (which is serializable)..

Anyone have any ideas

Thanks!for starters, what does your dataset contain?
any funky stuff in the dataset or just basic types?

i'm puzzled that an outofmemoryexception would contain a serialization
string

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Fletch" <anonymous@.discussions.microsoft.com> wrote in message
news:0F2E1CFD-71B2-41BA-9874-1AD07F3BDB5A@.microsoft.com...
> Hi,
> I have an application running on a cluster that's constantly throwing an
OutOfMemoryException with the following message:
> "Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'."
> In this instance, session state mode is set to 'StateServer' and the only
object being stored in the session is a dataset (which is serializable)..
> Anyone have any ideas?
> Thanks!

System.Reflection

Is there a way to determine that an assembly is running under an ASP.NET web
application as opposed to a Windows application?
For example, in an ASP.NET application if I call
Assembly.GetExecutingAssembly(), can I determine that the current assembly
is a web application?JV wrote:
> Is there a way to determine that an assembly is running under an ASP.NET w
eb
> application as opposed to a Windows application?
> For example, in an ASP.NET application if I call
> Assembly.GetExecutingAssembly(), can I determine that the current assembly
> is a web application?
>
You can check what class it's derived from, eg WinForm vs WebForm
JV,
I think a good way to test whether or not you are running in an ASP.NET
application is to access the static Current property on the HttpContext
class. If it is not running in ASP.NET, then the property should return
null.
Hope this helps.
- Nicholas Paldino [.NET/C# MVP]
- mvp@.spam.guard.caspershouse.com
"JV" <johnNOSPAMme@.goisc.com> wrote in message
news:OPATXEaJFHA.1280@.TK2MSFTNGP09.phx.gbl...
> Is there a way to determine that an assembly is running under an ASP.NET
> web application as opposed to a Windows application?
> For example, in an ASP.NET application if I call
> Assembly.GetExecutingAssembly(), can I determine that the current assembly
> is a web application?
>
Be aware if your solution doesn't have a reference to System.Web.dll, it
will throw an exception if you access System.Web.HttpContext.
bill
"Nicholas Paldino [.NET/C# MVP]" <mvp@.spam.guard.caspershouse.com> wrote in
message news:Olu$BMaJFHA.1172@.TK2MSFTNGP12.phx.gbl...
> JV,
> I think a good way to test whether or not you are running in an
ASP.NET
> application is to access the static Current property on the HttpContext
> class. If it is not running in ASP.NET, then the property should return
> null.
> Hope this helps.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@.spam.guard.caspershouse.com
> "JV" <johnNOSPAMme@.goisc.com> wrote in message
> news:OPATXEaJFHA.1280@.TK2MSFTNGP09.phx.gbl...
assembly
>
bill:
I think you meant to say "yield a compiler error", not "throw an
exception exception"...
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 10 Mar 2005 14:08:08 -0600, "William F. Robertson, Jr."
<theman@.nameht.org> wrote:

>Be aware if your solution doesn't have a reference to System.Web.dll, it
>will throw an exception if you access System.Web.HttpContext.
>bill
>
Thanks for making me think about my response. <grin> I actually didn't
even mean exception, infact after reading my response, I think I just
randomly typed something in that sounded good...
Not all threads in a asp.net application have a HttpContext.Current attached
to it. You can use the HttpContext.Current if you want to know if the
calling thread ( current context) is currently processing a request through
the Http Pipeline, but it is not a reliable indicator that the calling
assembly is a windows application, or a web app. Timers, callbacks, user
created threads, etc will have a null value and can be from either.
Thanks for straightening me out Scott!
bill
"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:csd131dhjmjjeuh906jql1a5f1l1bepett@.
4ax.com...
> bill:
> I think you meant to say "yield a compiler error", not "throw an
> exception exception"...
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> On Thu, 10 Mar 2005 14:08:08 -0600, "William F. Robertson, Jr."
> <theman@.nameht.org> wrote:
>
>
I have not tried this,
but instead of Assembly.GetExecutingAssembly(), try
Assembly.GetEntryAssembly()...
Greetings,
Henning Krause [MVP]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)
"JV" <johnNOSPAMme@.goisc.com> wrote in message
news:OPATXEaJFHA.1280@.TK2MSFTNGP09.phx.gbl...
> Is there a way to determine that an assembly is running under an ASP.NET
web
> application as opposed to a Windows application?
> For example, in an ASP.NET application if I call
> Assembly.GetExecutingAssembly(), can I determine that the current assembly
> is a web application?
>

Tuesday, March 13, 2012

System.Reflection

Is there a way to determine that an assembly is running under an ASP.NET web
application as opposed to a Windows application?

For example, in an ASP.NET application if I call
Assembly.GetExecutingAssembly(), can I determine that the current assembly
is a web application?JV wrote:
> Is there a way to determine that an assembly is running under an ASP.NET web
> application as opposed to a Windows application?
> For example, in an ASP.NET application if I call
> Assembly.GetExecutingAssembly(), can I determine that the current assembly
> is a web application?
>
You can check what class it's derived from, eg WinForm vs WebForm
JV,

I think a good way to test whether or not you are running in an ASP.NET
application is to access the static Current property on the HttpContext
class. If it is not running in ASP.NET, then the property should return
null.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@.spam.guard.caspershouse.com

"JV" <johnNOSPAMme@.goisc.com> wrote in message
news:OPATXEaJFHA.1280@.TK2MSFTNGP09.phx.gbl...
> Is there a way to determine that an assembly is running under an ASP.NET
> web application as opposed to a Windows application?
> For example, in an ASP.NET application if I call
> Assembly.GetExecutingAssembly(), can I determine that the current assembly
> is a web application?
Be aware if your solution doesn't have a reference to System.Web.dll, it
will throw an exception if you access System.Web.HttpContext.

bill

"Nicholas Paldino [.NET/C# MVP]" <mvp@.spam.guard.caspershouse.com> wrote in
message news:Olu$BMaJFHA.1172@.TK2MSFTNGP12.phx.gbl...
> JV,
> I think a good way to test whether or not you are running in an
ASP.NET
> application is to access the static Current property on the HttpContext
> class. If it is not running in ASP.NET, then the property should return
> null.
> Hope this helps.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@.spam.guard.caspershouse.com
> "JV" <johnNOSPAMme@.goisc.com> wrote in message
> news:OPATXEaJFHA.1280@.TK2MSFTNGP09.phx.gbl...
> > Is there a way to determine that an assembly is running under an ASP.NET
> > web application as opposed to a Windows application?
> > For example, in an ASP.NET application if I call
> > Assembly.GetExecutingAssembly(), can I determine that the current
assembly
> > is a web application?
bill:

I think you meant to say "yield a compiler error", not "throw an
exception exception"...

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 10 Mar 2005 14:08:08 -0600, "William F. Robertson, Jr."
<theman@.nameht.org> wrote:

>Be aware if your solution doesn't have a reference to System.Web.dll, it
>will throw an exception if you access System.Web.HttpContext.
>bill
Thanks for making me think about my response. <grin> I actually didn't
even mean exception, infact after reading my response, I think I just
randomly typed something in that sounded good...

Not all threads in a asp.net application have a HttpContext.Current attached
to it. You can use the HttpContext.Current if you want to know if the
calling thread ( current context) is currently processing a request through
the Http Pipeline, but it is not a reliable indicator that the calling
assembly is a windows application, or a web app. Timers, callbacks, user
created threads, etc will have a null value and can be from either.

Thanks for straightening me out Scott!

bill

"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:csd131dhjmjjeuh906jql1a5f1l1bepett@.4ax.com...
> bill:
> I think you meant to say "yield a compiler error", not "throw an
> exception exception"...
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> On Thu, 10 Mar 2005 14:08:08 -0600, "William F. Robertson, Jr."
> <theman@.nameht.org> wrote:
> >Be aware if your solution doesn't have a reference to System.Web.dll, it
> >will throw an exception if you access System.Web.HttpContext.
> >bill
I have not tried this,

but instead of Assembly.GetExecutingAssembly(), try
Assembly.GetEntryAssembly()...

Greetings,
Henning Krause [MVP]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)

"JV" <johnNOSPAMme@.goisc.com> wrote in message
news:OPATXEaJFHA.1280@.TK2MSFTNGP09.phx.gbl...
> Is there a way to determine that an assembly is running under an ASP.NET
web
> application as opposed to a Windows application?
> For example, in an ASP.NET application if I call
> Assembly.GetExecutingAssembly(), can I determine that the current assembly
> is a web application?

System.Security.Cryptography.CryptographicExceptio n:

Hi,

I have two web applications running on my machine.The
application is developed using asp.net 1.1 and vb.net.When i try to run
both the applications in the same browsers, i get the following error.
(System.Security.Cryptography.CryptographicExcepti on: Bad Data. at
System.Security.Cryptography.CryptoAPITransform._D ecryptData(IntPtr
hKey, Byte[] rgb, Int32 ib, Int32 cb, Boolean fDone) at
System.Security.Cryptography.CryptoAPITransform.Tr ansformFinalBlock(Byte[]
inputBuffer, Int32 inputOffset, Int32 inputCount) at
System.Security.Cryptography.CryptoStream.FlushFin alBlock() at
System.Web.Configuration.MachineKey.EncryptOrDecry ptData(Boolean
fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length) at
System.Web.Security.FormsAuthentication.Decrypt(St ring
encryptedTicket))

That is, when i run the first application and run the second
application in the same browser, i get this error.If i run it in two
different browsers, then it works fine.

Can any one help me out.r u using Forms authentication?

"muthu" <s.muthumanickam@.gmail.comwrote in message
news:1152521970.538688.249490@.m73g2000cwd.googlegr oups.com...

Quote:

Originally Posted by

Hi,
>
I have two web applications running on my machine.The
application is developed using asp.net 1.1 and vb.net.When i try to run
both the applications in the same browsers, i get the following error.
(System.Security.Cryptography.CryptographicExcepti on: Bad Data. at
System.Security.Cryptography.CryptoAPITransform._D ecryptData(IntPtr
hKey, Byte[] rgb, Int32 ib, Int32 cb, Boolean fDone) at
System.Security.Cryptography.CryptoAPITransform.Tr ansformFinalBlock(Byte[]
inputBuffer, Int32 inputOffset, Int32 inputCount) at
System.Security.Cryptography.CryptoStream.FlushFin alBlock() at
System.Web.Configuration.MachineKey.EncryptOrDecry ptData(Boolean
fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length) at
System.Web.Security.FormsAuthentication.Decrypt(St ring
encryptedTicket))
>
That is, when i run the first application and run the second
application in the same browser, i get this error.If i run it in two
different browsers, then it works fine.
>
Can any one help me out.
>

System.Threading.ThreadAbortException

Hi,

I'm running some code that posts from my application (ASP.Net) to a Payment Gateway. I get this error - [System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}. I guess this is because my I am transfering to another server and once this is done my code doesn't know what to do with itself.

Could someone explain what this error is precisely, and how I might avoid it.

Regards,

Quinton Smith

For any one wondering what I did to get this working as no one answered, I had to move my code transferring so that it was the last code running before transfer and not in any try/catch blocks.

Still don't quite understand the error description though.

Quinton


Not enough info to give an accurate answer, but if you're using Response.Redirect:

From Visual Studio Help:
Redirect calls End which always raises a ThreadAbortException exception upon completion.

NC...


youre the man! out of the first couple of posts yours is the only one that actually helped KUDOS!

Hi Programmers,

I am using asp.net 2.0 with c#.

" myReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, rptName);"

As soon as compiler execute this statement i get error

" [System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} "

What will be the possible reasons for the error.

Sorry for the bad english.


I believe that this is because, Response.End is called internally in the ExportToHttpResponse method:

Try wrapping it in a try/catch block:

try
{
myReportDocument.ExportToHttpResponse(...);
}
catch (System.Threading.ThreadAbortException)
{
}

NC...


Thanks for reply,

I m already using try{} catch{} block

try

{

Some coding here

try
{

Response.TransmitFile("CodeGeneratedFiles/" + TemplateFileName);
Response.End();
}

catch (System.Threading.ThreadAbortException ex)
{
Log.WriteLog("Report Viewer", "Set The Datasource", ex.Source, ex.Message);
}

Response.Addheader("Title","Some Name for Popup");

}

Catch(Exception ex)

{

}

But it does not execute "Response.Addheader("title","Some Name for Popup");" after catch block it directly jumps to outer catch block.

Is there anyway to kill the exception..

Is there no other way to solve this error.[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}

Hope to hear u soon.


No as I think there is a bug in ExportToHttpResponse. You might try Googling ExportToHttpResponse and System.Threading.ThreadAbortException. I found some work-a-rounds there.

NC...