|
Have you looked through all the dotnetnuke doucmentation materials? Sure there has to be something that can shed light.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi
does anybody know me why MessageBox.Show() fails after setting a FileIOPermission PermitOnly() on a file??
{
FileIOPermission myFileIOPermission = new FileIOPermission(FileIOPermissionAccess.Write,@"C:\PermitOnly.txt");
myFileIOPermission.PermitOnly();
// this causes an exception...
MessageBox.Show(@"PermitOnly active");
// whereas this is fine
FileIOPermission.RevertPermitOnly();
MessageBox.Show(@"PermitOnly reverted");
}
thanks, John
|
|
|
|
|
cSharpJR wrote: why MessageBox.Show() fails after
define fails
|
|
|
|
|
hi
found out the answer I was looking for
basically, setting PermitOnly() on FileIOPermission meant that ALL other permissions are revoked, including default for UIPermission, hence the exception when displaying a message after calling FileIOPermission PermitOnly()
the solution lies in permission sets. Add the required file IO permission and a UI permission to a permission set and then call the permission set PermitOnly(), so (only) the group of permissions in the permission set are allowed
{
PermissionSet myPermissionSet = new PermissionSet(PermissionState.None);
FileIOPermission myFileIOPermission = new FileIOPermission(FileIOPermissionAccess.Write, @"C:\PermitOnly.txt");
UIPermission myUIPermission = new UIPermission(PermissionState.Unrestricted);
myPermissionSet.AddPermission(myFileIOPermission);
// test - comment out adding UI permission and MessageBox.Show() will fail due to no UI permission in permission set
myPermissionSet.AddPermission(myUIPermission);
myPermissionSet.PermitOnly();
MessageBox.Show("Permission set permit only active");
}
thanks, John
|
|
|
|
|
It doesn't seem like there would be too much overhead...
Any ideas?
|
|
|
|
|
I'm trying to get the email addresses contained in a distribution list in a public folder using the Outlook 12.0 Object Library.
I can get the distribution list (as Outlook._DistListItem), but can not figure out how to get the addresses contained in it. Does anyone have an idea/pointer that would help?
using Outlook = Microsoft.Office.Interop.Outlook;
outlook = new Outlook.Application();
Outlook._NameSpace olNS = outlook.GetNamespace("MAPI");
Outlook.MAPIFolder oPublicFolder = olNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olPublicFoldersAllPublicFolders);
Outlook.MAPIFolder tiFolder = null;
foreach (Outlook.MAPIFolder currentFolder in oPublicFolder.Folders)
{
if ("DesiredFolder" == currentFolder.Name)
{
tiFolder = currentFolder;
break;
}
}
if (null != tiFolder)
{
Outlook._Items oItems = tiFolder.Items;
for (int i = 1; i <= oItems.Count; i++)
{
try
{
Outlook._ContactItem oContact = (Outlook._ContactItem)oItems[i];
}
catch (Exception ex)
{
try
{
Outlook._DistListItem distributionList = (Outlook._DistListItem)oItems[i];
}
catch (Exception ex1)
{
}
}
}
|
|
|
|
|
I have 2 aspx pages.
first aspx has crystal report viewer.
second aspx has a button and we are calling first aspx page in button click.
now when i get a report, i click on export icon which displaya export options dialog but here i will close first aspx and then i will click ok button of export option. it gives you "Access denied error"
how do we solve this issue.
|
|
|
|
|
Sounds like you have a file locking issue. Also, you have an issue with your location - this belongs in the ASP.NET forum.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am creating an application that reads all of the dlls that are in the same folder as the executing application and looks for classes that implement a certain interface (a pluggable application). I can do this pretty easily with just OO programming, but how would one go about doing this with TDD (I am still trying to get my head around this in situations that are more complex)? Would I need to abstract the FileSystem and assemblies? Thanks in advance.
Mike Lasseter
|
|
|
|
|
mr_lasseter wrote: but how would one go about doing this with TDD
Test Driven Development? You might need to explain your thoughts more specifically.
mr_lasseter wrote: Would I need to abstract the FileSystem and assemblies?
Not sure what you mean because those are both already abstracted right?
led mike
|
|
|
|
|
I got a winform which is displayed in browser...the a.exe file has a config file which has a key to choose between production and dev databases. I created the iexplore.exe.config file with the required config file keys and kept in the root folder(c:/inetpub/wwwroot/)...when i run the a.exe file in browser its not reading the iexplore.exe.config file at all ....could any 1 please help me...
a.exe (.net2.0 app) working in IE6 in win 2003 server
Thanks in advance.....
|
|
|
|
|
OK, so you spammed the whole site with this. How do you know it's not reading the config file ? Why do you expect it to ? Did you write code to read it ? Or did you expect a.exe to access a config file based on the program that contains it ( I am not sure, it may work this way, but it sounds like it isn't, right ? )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
5th Times !!!!
you are realy
|
|
|
|
|
Quit cross posting. That is just flat out rude and doesn't get you any help.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hy there, I have a big problem. I need to play sounds(for now WAVs), more at a time. I have a method, because I used DirectSound3 on C++ and it worked. So I made a native dll that has 4 methods: one to initialize DirectSound, one to add a sound, one to play and one to stop.
The add methods looks like this:
[DllImport("playsound.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]
public static extern void Add(string name,bool looped,IntPtr data);
At first,I had the wav sound in my application Resources(as an unmanaged memory stream), so I have done this:
data = new byte[Resource.win.Length];
Resource.sound.Read(data, 0, Resource.sound.Length);
handle = GCHandle.Alloc(data, GCHandleType.Pinned);
DirectSound.Add("soundname", false, handle.AddrOfPinnedObject());
The application seems to work fine. The sound does play. My problems started when I placed a button on the form.Even if the button doesn't do anything,pressing him increases app memory. When the application reaches a level(at my computer,aproximately 10 MB), the output shows "thread X exited with code.." and,from now on, the application is frozen,it blocks(at the method Play).
I suspect that the thread that exited was the garbage collector, and it messed up my sound.But I have a GCHandle on it...
When the method Add is called, the native dll(made in C++ Builder) uses new to create a buffer. Does .NET ignore that..and considers it unused memory?I can't tell .NET what is in that dll...because it is native. How do I stop him from taking that memory?
PS: If I load the sound directly from a file (!) the application does not froze,it just doesn't play the sound. Maybe because the resources are an object? So when the garbage collecter works,it compacts the memory?
If someone is fammiliar with this kind of problems, please help me, I am really stuck. Thans in advance.
|
|
|
|
|
From the code shown, it's impossible to determine the way you
are managing the lifetime of your objects.
What makes you think the GC is involved?
ctoma2005 wrote: When the method Add is called, the native dll(made in C++ Builder) uses new to create a buffer. Does .NET ignore that..and considers it unused memory?
The .NET framework doesn't know anything about that allocated memory. The memory
is allocated on whatever heap the new operator is using in the DLL code.
ctoma2005 wrote: data = new byte[Resource.win.Length];
Resource.sound.Read(data, 0, Resource.sound.Length);
I'm curious about this....why are different "Length"s used on these two lines?
Mark
|
|
|
|
|
Sorry, the wav was named(in my code), "win", I wanted to changed to "sound" so it has a more common name.
That's just it, the native dll holds a list of it's own of sounds that where added. So I don't really have objects. I am pretty sure that GC is involved, because GC has a background thread. I didn't start any threads. Plus, my sound does not play anymore, so the space the native dll allocated must not be there. The sound buffer is still there, as I placed a pinned handle on it. But how can I be sure that memory allocated by the native dll is not destroyed?
|
|
|
|
|
I think I found why the application is blocked. After I call the method Add(...), if I call GC.Collect() it freezes. I have no ideea why this is,I mean if .NET doesn't know anything about that memory, why can't it collect the unused objects?
|
|
|
|
|
Why are you calling Collect()?
The GC won't (and can't) do anything with the native memory blocks allocated in your native DLL.
The GC will eventually clean up managed objects that no longer have an outstanding reference.
It's up to you to manage the lifetime of your objects - both native and managed.
You have a problem somewhere obviously, but the GC should be irrelevant.
Mark
|
|
|
|
|
I'm not sure your marshaling is correct here...
What does the Add() function look like on the native side (it's prototype)?
Mark
|
|
|
|
|
Sorry, I have the code at work,I will put the signature tomorrow. Do you have the time to look at the sources? The native part is not big at all. And the managed part just calls an initialize method and the add method. I don't want to call GC.Collect(), but it will be called eventually, so I tried it manually, and the application freezes.
Please tell me if it's ok with you to send the sources. The more I dig..the more I get stuck with this problem.
|
|
|
|
|
I can take a look at it. Send me an email via Code Project and I'll reply.
Mark
|
|
|
|
|
|
System.Windows.Forms.SystemInformation.VerticalScrollBarWidth;
led mike
|
|
|
|
|
I don't mean this in a cynical way; if it's a good choice for my scenario, I'll use it.
It seems like I could make use of it if I'm writing, say, a checkout app: customer comes in, does some shopping, comes to the counter, the clerk scans all the barcodes, asks if the customer has a point card, prints a receipt, saves the transaction and marketing info to the database.
But I still can't quite put my finger on why it would be better to use Workflow Foundation than to just do all this by wiring a database to a client UI using LINQ to SQL. Any ideas?
Thanks in advance,
Rei
|
|
|
|