|
The below is the entire error...
Thanks and I truely appreciate any help.
Unhandled Exception: System.Security.SecurityException: Request failed.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly a
sm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, Secur
ityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object ass
emblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet gran
ts, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Objec
t assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs
, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMet
hodHandle rmh, Assembly asm, SecurityAction action)
at ConsoleApplication_uisftp.HelloWorld.Main()
The action that failed was:
LinkDemand
The type of the first permission that failed was:
System.Security.PermissionSet
The demand was for:
<permissionset class="System.Security.PermissionSet"
version="1"
unrestricted="true">
The granted set of the failing assembly was:
<permissionset class="System.Security.PermissionSet"
version="1">
<ipermission class="System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
read="USERNAME">
<ipermission class="System.Security.Permissions.FileDialogPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Security.Permissions.FileIOPermission, mscorlib, Vers
ion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
read="R:\C#2\ConsoleApplication uisftp\ConsoleApplication uisftp\bin\Debug\"
pathdiscovery="R:\C#2\ConsoleApplication uisftp\ConsoleApplication uisftp\bin\De
bug\">
<ipermission class="System.Security.Permissions.IsolatedStorageFilePermission, m
scorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
allowed="AssemblyIsolationByUser"
userquota="9223372036854775807"
expiry="9223372036854775807"
permanent="True">
<ipermission class="System.Security.Permissions.ReflectionPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
flags="ReflectionEmit">
<ipermission class="System.Security.Permissions.SecurityPermission, mscorlib, Ve
rsion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
flags="Assertion, Execution, BindingRedirects">
<ipermission class="System.Security.Permissions.UIPermission, mscorlib, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
url="file:///R:/C#2/ConsoleApplication uisftp/ConsoleApplication uisftp/bin/Debu
g/ConsoleApplication uisftp.exe">
<ipermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib
, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
zone="Intranet">
<ipermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=n
eutral, PublicKeyToken=b77a5c561934e089"
version="1"
unrestricted="true">
<ipermission class="System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
level="DefaultPrinting">
The assembly or AppDomain that failed was:
ConsoleApplication uisftp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///R:/C#2/ConsoleApplication uisftp/ConsoleApplication uisftp/bin/Debug/Con
soleApplication uisftp.exe
Press any key to continue . . .
|
|
|
|
|
are you programming in a limited xp account? is so then dont.
or is this running in a secure NT network? if so... what kind of premissions do you have and what external(things other than your computer) resources are you trying to reach.
|
|
|
|
|
I have an issue with stopping threads in a windows service application I was wondering if anyone can help. let me set it up for you. In a windows service you have to use the OnStart method to initialize your application... but you cannot run any loops or sequence of events that contain loops or the state of the application will be in an "starting" service mode indefinitely. So I start a thread call Maint to handle the application. The application has threee main functions at the moment that interface with WAN file shares and a sql db. I run these parallel each in there own thread(and they dont interact with eachother). so in the OnStart method:
maint Maint = new maint();<br />
maintThread = new Thread(new ThreadStart(Maint.start));<br />
maintThread.Start();
in that start method i call:
importassets ia = new importassets();<br />
importThread = new Thread(new ThreadStart(ia.importasset));<br />
importThread.Start();<br />
<br />
updatereg ur = new updatereg();<br />
updateThread = new Thread(new ThreadStart(ur.runupdate));<br />
updateThread.Start();<br />
<br />
forcelogins fl = new forcelogins();<br />
loginThread = new Thread(new ThreadStart(fl.runlogins));<br />
loginThread.Start();<br />
<br />
int startTime = System.Environment.TickCount; <br />
int runTime = startTime+3600000;<br />
while(true)<br />
{<br />
int nowTime = System.Environment.TickCount;<br />
FAISservice fs = new FAISservice();<br />
if(!fs.isRunning)<br />
break;<br />
if(runTime < nowTime)<br />
{<br />
importThread.Abort();<br />
Thread.Sleep(3000);<br />
startImport();<br />
runTime = nowTime+3600000;<br />
}<br />
Thread.Sleep(10000);<br />
<br />
}
Now, all works fine until the OnStop() method gets called by the service being stopped or restarted. in the OnStop() method i run:
isRunning = false;<br />
<br />
maintThread.Abort();<br />
<br />
maint Maint = new maint();<br />
Maint.stop();
and in the stop() method i call:
importThread.Abort();<br />
updateThread.Abort();<br />
loginThread.Abort();
Now I'm locked in a "STOPPING" state and i have to kill the process... any clues? also... my above 3 threads start while(true) loops that only BREAK when isRunning=false.
|
|
|
|
|
We have a similar situation, and basically, in our thread classes, we have created a Shutdown() method.
The threads themselves this method at different points in their loops (where it is practical for them to gracefully stop), and simply shut themselves down when this method returns true. The threads do not stop immediately, like from a Thread.Abort(), but this way they are given a chance to terminate gracefully.
In the thread proc, the method is coded as so:
public class SomeThread
{
// This variable is used by multiple threads, so it must be thread-safe.
// Do not access it directly -- use the ShutDown property instead.
private bool m_bTimeToShutdown = false;
private Object ShutDownLock = new Object();
// Other variables and methods go here......
/// <summary>
/// This property can be set to tell the main loop to stop processing.
/// The main loop continues to run as long as this property is false.
/// </summary>
public bool ShutDown {
get {
bool rslt;
lock (ShutDownLock) {
rslt = m_bTimeToShutdown;
}
return rslt;
}
set {
lock (ShutDownLock) {
m_bTimeToShutdown = value;
}
}
}
}
Calling example (in the Main service):
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
// TODO: Add code here to perform any tear-down necessary to stop your service.
log.Info("Shutting down some thread"); // This is just a sample logging call.
SomeThreadThrdProc.ShutDown = true;
}
I hope this helps you.
Tom Delany
|
|
|
|
|
Greetings,
I have the need to place an arraylist into a pageddataset that fills a repeater. The command buttons and total number of pages is all there, however, the pagelimit is not working. I have resolved the data source to iEnumerable, to no avail.
Can anyone assist? Here is the code...Thanks!!!
override
protected void OnLoad(EventArgs e)
{
EnsureChildControls();
// Populate the repeater control with the Items DataSet
PagedDataSource objPds = new PagedDataSource();
objPds.PageSize = 10;
objPds.AllowPaging = true;
objPds.CurrentPageIndex = CurrentPage - 1;
if (Confirm && PledgeID != -1)
{
objPds.DataSource = (IEnumerable) ResolveDataSource(array list );
}
else
{
//objPds.DataSource = PledgeUtility.GetAllPledges(ModerationStatus.Pending);
objPds.DataSource = (IEnumerable) ResolveDataSource(array list));
}
// Set the PagedDataSource's current page
lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of "
+ objPds.PageCount.ToString();
// Disable Prev or Next buttons if necessary
cmdPrev.Enabled = !objPds.IsFirstPage;
cmdNext.Enabled = !objPds.IsLastPage;
rptPledgeList.DataSource = objPds.DataSource;
rptPledgeList.DataBind();
pnlNoPledges.Visible = (rptPledgeList.Items.Count == 0);
}
// *****************************************************************
// *****************************************************************
// Resolve the data source and normalize it to IEnumerable
private IEnumerable ResolveDataSource(object dataSource)
{
IListSource listSource;
IList list;
if (dataSource == null)
return null;
listSource = (dataSource
as IListSource);
if (listSource != null)
{
list = listSource.GetList();
return list;
}
if ((dataSource as IEnumerable) != null)
return (IEnumerable) dataSource;
return null;
}
// *****************************************************************
|
|
|
|
|
i want to start programming neural nets using c#???
adsf e ed w we we w
|
|
|
|
|
Are you sure?
If so, search this site and you will find some articles about neural networks in C#. Some recently added articles were very good.
Josh
|
|
|
|
|
I suppose this might be appropriate in the web development forum too, but this seemed better.
In trying out this[^], I notice it works fine in .NET 1.1, but the text never gets set when I click on Change Text when the dll is compiled in .NET 2.0.
Someone else[^] had a similar problem with an article here on CP.
Any ideas?
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
Never mind, found the answer. You have to make the assembly COM visible.
Marc
Pensieve
Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
|
|
|
|
|
Hi guys,
Please help! I have a form with combo box and a bunch of text boxes, when the form is opened I am populating the combo box and the text boxes with data from a table. My question is that when I delete one of the field data on the combo box, I still see it in the drop down menu. How can I refresh it or reload it so I don't see the deleted data. Please help!!!
sasa
|
|
|
|
|
If you're binding the comboboxes to a datatable, then it should automatically refresh. You may want to try .EndEdit() on the row after you have deleted it.
|
|
|
|
|
EndEdit() function doesn't exist, I tried EndUpdate() and no luck. I am not binding the data. How do I bind data?
sasa
|
|
|
|
|
Nevermind, I got it to work by doing a clear. This is what I am doing now. I am using the combobox.items.add() property and then when I am done editting or deleting I am using combobox.items.clear(); and then recalling my populate function which adds the data back to the combobox.
It seems to work well.
Thanks for your help though.
sasa
|
|
|
|
|
For example now is tuesday 20/6/2006, how can i do to cout the number of tuesday from 1/1/2006 to now.
Help me huhuhu
I tried so hard and got so far
|
|
|
|
|
Hmmmmmm sounds like another homework assignment. You will not get a your homework done by us, however I can give you a direction to head:
Think: DateTime.AddDays() and DateTime.DayOfWeek along with a for loop.
|
|
|
|
|
System.DateTime today = System.DateTime.Now;
int iDOY = today.DayOfYear();
The above will tell you (in iDOY) what day of the year the current date is (i.e. number between 1 and 366).
Tom Delany
|
|
|
|
|
For testing purposes, I created a simple Word 2003 Template with 2 fields. I then set the protection level to "Filling in Forms". The template itself is fine and works as expected within Word. In other words, when I open the template in Word, I am presented with a new document in which I can only enter values in the two supplied fields and save the document.
Also for testing purposes, I wrote a C# app to automate filling in my sample template. In my C# app, I start word, open the template, find a field, and attempt to enter a value.
object bookmark = "Text1";
Word.Bookmark myBookmark = myWordTemplate.Bookmarks.get_Item(ref bookmark);
myBookmark.Select();
myBookmark.Range.Text = "Hello";
Upon trying to assign a value to the field, I get an exception stating the value can't be changed because protection is enabled. Since the protection level is set to "Filling in Forms", does anyone have any idea why this exception is being thrown? Or is the above not the proper way to fill fields defined in a word template?
Last, please note that if (in my code) I disable protection, write my value, re-enable protection, and save the document, my code works but with the following unwanted side effects:
- Within my C# app, the field/bookmark object gets overwritten/deleted, as in it gets deleted from the field/bookmark collection.
- My first comment is confirmed by opening the resulting document in Word -- any field to which I assigned a value (in code) is no longer there. The value I wrote is there and in the proper place, but the template itself is basically destroyed. In other words, when I automate filling in the form, the user isn't able to open the resulting document and make any changes like they could if they manually filled in the form with Word.
Any suggestion or workaround would be appreciated.
Vince
|
|
|
|
|
It seems I gave up a bit too soon. So, to answer my own question... this works.
object bookmark = "Text1";
myWordTemplate.FormFields.get_Item(ref bookmark).Result = "Hello";
|
|
|
|
|
Hi
I am trying to submit multiple submission through textarea.(ASP.NET/C#)
For instance, I'd allow user to submit group of number(i.e. 11111, 22222, 33333, 44444, etc)
The issue is user can submit up to 50 numbers(submission) and the system doesn't know how many numbers s/he will exactly submit. It could be 1 or 2, or 45 or 50.
I guess I can't use standard array with split function because there's no numbers declared.
Anyone has any idea?
Thank you!
|
|
|
|
|
edgtr wrote: I guess I can't use standard array with split function because there's no numbers declared.
Not sure what you mean by that, but yes you would split the text and (in VS2005) that would give you an array of numbers entered. From there you can use array.Length to validate that they have not exceeded the maximum and then a for loop to trim and convert each item into a number.
The only minimum requirement you would have is that the separator must be consistent and it must be entered for between every number.
string[] enteredList = entry.Text.Split(',');
foreach (string number in enteredList)
{
try
{
int value = Convert.ToInt32( number.Trim() );
}
catch
{
errorMessage.Text += number + " is not a valid number ";
}
}
|
|
|
|
|
" class to be both marked with the serializable attribute and extend MarshalByRefObject "
when will we use this concept.
-- modified at 23:28 Monday 19th June, 2006
|
|
|
|
|
Why do you ask? What put this question into your mind?
Josh
|
|
|
|
|
Hi,
I am looking for C# interview style programming problems for my self to practice with. I would like to
find some material that tests problem solving skills, efficiency of implementation as well as knowledge of
the language, though not overly complicated.
Something along the lines of algorithm implementation like fibonacci series, problems that ought not to
take more that say 20 mins max to solve. I'd appreciate your comments, suggestions, links, resources, ect.
P.S. Can anyone recommend C# equivalent books to "Effective C++" & Efficient C++"?
|
|
|
|
|
antoan wrote: P.S. Can anyone recommend C# equivalent books to "Effective C++" & Efficient C++"?
Effective C# by Bill Wagner
|
|
|
|
|
|