Showing posts with label operation. Show all posts
Showing posts with label operation. Show all posts

Wednesday, March 28, 2012

System.InvalidOperationException: Collection was modified; enumeration operation may not e

hi all,

i am getting the following error when i am trying to move the ltems form listbox1 to listbox2

"System.InvalidOperationException: Collection was modified; enumeration operation may not execute"

ForEach itemAs ListItemIn Listbox1.Items

If item.SelectedAndNot Listbox2.Items.Contains(item)Then

Dim newItemAsNew ListItem(item.Text, item.Value)

Listbox2.Items.Add(newItem)

listbox1.Remove(newitem)

EndIf

Next

thanks.

You can't modify the listbox1 item collection while you are iterating over it using "for each". Wait until you add everything to listbox2, and then call Clear() on listbox1.

Tuesday, March 13, 2012

System.Runtime.InteropServices.COMException: Operation is not allowed in this context

I just thought I would ask about this error, since I have found no
references to it on the web elsewhere.
I have a COM object from regular ASP, written for an older app that my
business needs to use, that I need to use in ASP.NET. The error
occurs here:
object obj = "test";
String testVal = (String)obj;
OldASPClass pickup = new OldDLL_dotnetproxy.OldASPClass();
pickup.MyFunc(testVal, testVal, testVal);
Somehow I ended up in a situation where it seems everything I do is
for the first time. So just as an FYI, I am an ASP.NET newbee. Does
anyone know what is going on here?On Jul 4, 4:25 pm, Dave <onlinef...@.gmail.com> wrote:
> I just thought I would ask about this error, since I have found no
> references to it on the web elsewhere.
> I have a COM object from regular ASP, written for an older app that my
> business needs to use, that I need to use in ASP.NET. The error
> occurs here:
> object obj = "test";
> String testVal = (String)obj;
> OldASPClass pickup = new OldDLL_dotnetproxy.OldASPClass();
> pickup.MyFunc(testVal, testVal, testVal);
> Somehow I ended up in a situation where it seems everything I do is
> for the first time. So just as an FYI, I am an ASP.NET newbee. Does
> anyone know what is going on here?
I forgot to mention that the data types in this proxy function look
like this:
object OldASPClass.MyFunc(object x, object y, object z)
I'm just trying to pass the correct data types to this function to get
this to work.
On Jul 4, 4:46 pm, Dave <onlinef...@.gmail.com> wrote:
> On Jul 4, 4:25 pm, Dave <onlinef...@.gmail.com> wrote:
>
>
>
>
> I forgot to mention that the data types in this proxy function look
> like this:
> object OldASPClass.MyFunc(object x, object y, object z)
> I'm just trying to pass the correct data types to this function to get
> this to work.
FYI, I figured it out. It was an error specific to the function
inside the DLL having to do with my input strings being formatted in a
way it didn't like.

System.Runtime.InteropServices.COMException: Operation is not allowed in this context

I just thought I would ask about this error, since I have found no
references to it on the web elsewhere.

I have a COM object from regular ASP, written for an older app that my
business needs to use, that I need to use in ASP.NET. The error
occurs here:

object obj = "test";
String testVal = (String)obj;
OldASPClass pickup = new OldDLL_dotnetproxy.OldASPClass();
pickup.MyFunc(testVal, testVal, testVal);

Somehow I ended up in a situation where it seems everything I do is
for the first time. So just as an FYI, I am an ASP.NET newbee. Does
anyone know what is going on here?On Jul 4, 4:25 pm, Dave <onlinef...@.gmail.comwrote:

Quote:

Originally Posted by

I just thought I would ask about this error, since I have found no
references to it on the web elsewhere.
>
I have a COM object from regular ASP, written for an older app that my
business needs to use, that I need to use in ASP.NET. The error
occurs here:
>
object obj = "test";
String testVal = (String)obj;
OldASPClass pickup = new OldDLL_dotnetproxy.OldASPClass();
pickup.MyFunc(testVal, testVal, testVal);
>
Somehow I ended up in a situation where it seems everything I do is
for the first time. So just as an FYI, I am an ASP.NET newbee. Does
anyone know what is going on here?


I forgot to mention that the data types in this proxy function look
like this:

object OldASPClass.MyFunc(object x, object y, object z)

I'm just trying to pass the correct data types to this function to get
this to work.
On Jul 4, 4:46 pm, Dave <onlinef...@.gmail.comwrote:

Quote:

Originally Posted by

On Jul 4, 4:25 pm, Dave <onlinef...@.gmail.comwrote:
>

Quote:

Originally Posted by

I just thought I would ask about this error, since I have found no
references to it on the web elsewhere.


>

Quote:

Originally Posted by

I have a COM object from regular ASP, written for an older app that my
business needs to use, that I need to use in ASP.NET. The error
occurs here:


>

Quote:

Originally Posted by

object obj = "test";
String testVal = (String)obj;
OldASPClass pickup = new OldDLL_dotnetproxy.OldASPClass();
pickup.MyFunc(testVal, testVal, testVal);


>

Quote:

Originally Posted by

Somehow I ended up in a situation where it seems everything I do is
for the first time. So just as an FYI, I am an ASP.NET newbee. Does
anyone know what is going on here?


>
I forgot to mention that the data types in this proxy function look
like this:
>
object OldASPClass.MyFunc(object x, object y, object z)
>
I'm just trying to pass the correct data types to this function to get
this to work.


FYI, I figured it out. It was an error specific to the function
inside the DLL having to do with my input strings being formatted in a
way it didn't like.

System.Security.SecurityException: Permission denied Error while invoking methods in a Com

Hi,
I am getting an error while trying to create an excel file.
"Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.
Exception Details: System.Security.SecurityException: Permission denied"

This is what I am doing. we had an app that was written in VB to take
specific dates and create an excel file.
I am using the dll in my .NET app but it displays the error while writing
the file...

I am sure that I have used regsrv32 to register the DLL

any suggestions,
Stephenyou said you are using the COM server DLL directly in .net? If thats
what you are doing.. you need to create an interop assembly before you
can access the methods in that dll

Please let me know if I understoof your question incorrectly

stephen wrote:

Quote:

Originally Posted by

Hi,
I am getting an error while trying to create an excel file.
"Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.
Exception Details: System.Security.SecurityException: Permission denied"
>
This is what I am doing. we had an app that was written in VB to take
specific dates and create an excel file.
I am using the dll in my .NET app but it displays the error while writing
the file...
>
I am sure that I have used regsrv32 to register the DLL
>
any suggestions,
Stephen


Are you trying to run the application over the network? If so, see
http://blogs.msdn.com/shawnfa/archi...6/20/57023.aspx. (If you're
using version 2.0 of the .NET framework, ClickOnce is another option for
permissions elevation.)

If you're not attempting to run the applicaiton over the network, could you
please post the complete exception details (including call stack listing),
as returned from its ToString method?

"stephen" <stephen_jn@.hotmail.comwrote in message
news:%23F0g$XxuGHA.324@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

>
Hi,
I am getting an error while trying to create an excel file.
"Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the required
permission please contact your system administrator or change the
application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Permission denied"
>
This is what I am doing. we had an app that was written in VB to take
specific dates and create an excel file.
I am using the dll in my .NET app but it displays the error while writing
the file...
>
I am sure that I have used regsrv32 to register the DLL
>
any suggestions,
Stephen
>


Hi Kumar and Nicole,

This is how I am working on this project. I have a DLL given to me by
another developer that generates Excel files and he created it using VB6.
I registered it on my box, referenced it and I am trying to use it
This is the error I am getting along with stack trace:

Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.

Exception Details: System.Security.SecurityException: Permission denied

[SecurityException: Permission denied]
CBAS_DTStoExcel.CBQueryDTStoExcelClass.set_OutPath (Object ) +0
cbas.QueryDB.ExportToExcel(DateTime dBeginDate, DateTime dEndDate) in
C:\Inetpub\wwwroot\CBAS_Deploy\QueryDB.aspx.vb:74
cbas.QueryDB.btnRunReport_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\CBAS_Deploy\QueryDB.aspx.vb:53
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +2112
System.Web.UI.Page.ProcessRequest() +217
System.Web.UI.Page.ProcessRequest(HttpContext context) +18
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionStep.Execute()
+179
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87

"Kumar Reddi" <kumarreddi@.gmail.comwrote in message
news:1155062429.705709.30770@.h48g2000cwc.googlegro ups.com...

Quote:

Originally Posted by

you said you are using the COM server DLL directly in .net? If thats
what you are doing.. you need to create an interop assembly before you
can access the methods in that dll
>
Please let me know if I understoof your question incorrectly
>
stephen wrote:

Quote:

Originally Posted by

>Hi,
>I am getting an error while trying to create an excel file.
>"Description: The application attempted to perform an operation not
>allowed
>by the security policy. To grant this application the required permission
>please contact your system administrator or change the application's
>trust
>level in the configuration file.
>Exception Details: System.Security.SecurityException: Permission denied"
>>
>This is what I am doing. we had an app that was written in VB to take
>specific dates and create an excel file.
>I am using the dll in my .NET app but it displays the error while writing
>the file...
>>
>I am sure that I have used regsrv32 to register the DLL
>>
>any suggestions,
>Stephen


>


It looks like your ASP.NET application is not probably not running with
unrestricted CAS permissions (aka full trust). Unless you have restricted
CAS permissions via your own application's web.config file, adjusting this
is a task for the server administrator. (If you are in shared hosting, it's
likely that the administrator will be unwilling to increase your
application's permissions, and you may need to move to dedicated hosting.)

"stephen" <stephen_jn@.hotmail.comwrote in message
news:%23DomAH0uGHA.5044@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Hi Kumar and Nicole,
>
This is how I am working on this project. I have a DLL given to me by
another developer that generates Excel files and he created it using VB6.
I registered it on my box, referenced it and I am trying to use it
This is the error I am getting along with stack trace:
>
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.
>
Exception Details: System.Security.SecurityException: Permission denied
>
>
[SecurityException: Permission denied]
CBAS_DTStoExcel.CBQueryDTStoExcelClass.set_OutPath (Object ) +0
cbas.QueryDB.ExportToExcel(DateTime dBeginDate, DateTime dEndDate) in
C:\Inetpub\wwwroot\CBAS_Deploy\QueryDB.aspx.vb:74
cbas.QueryDB.btnRunReport_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\CBAS_Deploy\QueryDB.aspx.vb:53
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
>
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +2112
System.Web.UI.Page.ProcessRequest() +217
System.Web.UI.Page.ProcessRequest(HttpContext context) +18
>
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionStep.Execute()
+179
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87
>
>
>
>
>
>
"Kumar Reddi" <kumarreddi@.gmail.comwrote in message
news:1155062429.705709.30770@.h48g2000cwc.googlegro ups.com...

Quote:

Originally Posted by

>you said you are using the COM server DLL directly in .net? If thats
>what you are doing.. you need to create an interop assembly before you
>can access the methods in that dll
>>
>Please let me know if I understoof your question incorrectly
>>
>stephen wrote:

Quote:

Originally Posted by

>>Hi,
>>I am getting an error while trying to create an excel file.
>>"Description: The application attempted to perform an operation not
>>allowed
>>by the security policy. To grant this application the required
>>permission
>>please contact your system administrator or change the application's
>>trust
>>level in the configuration file.
>>Exception Details: System.Security.SecurityException: Permission denied"
>>>
>>This is what I am doing. we had an app that was written in VB to take
>>specific dates and create an excel file.
>>I am using the dll in my .NET app but it displays the error while
>>writing
>>the file...
>>>
>>I am sure that I have used regsrv32 to register the DLL
>>>
>>any suggestions,
>>Stephen


>>


>
>