|
I have a problem with checking file permissions. I'm trying to check wether a user can write, read to a specific folder/file but when i test my code it says it can even thou i have removed all permissions. Don't know if the code is correct.
<br />
FileIOPermission filePermission = new<br />
FileIOPermission(FileIOPermissionAccess.Write,<br />
Request.PhysicalApplicationPath+@"test\\test.txt");<br />
try<br />
{<br />
filePermission.Demand();<br />
Reponse.Write("Permission demand successful");<br />
}<br />
catch( SecurityException securityEx )<br />
{<br />
Reponse.Write(securityEx.Message);<br />
}<br />
|
|
|
|
|
Did you just unchecked the boxes marked Allow, or did you check the boxes marked Deny? If you just unchecked the Allow boxes, you're actually letting permissions from the parent folders to apply to the file in question. You have to explicitly deny access to the file if you wan't to take all rights away.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have tested all things when it comes to permissions. It still says that it can write.
But it cant when actually trying to write to a file.
There something with the permission code thats wrong I just dont know what.
|
|
|
|
|
Hi there
I want to set a progressbar property in my user control and I don't want to be changable in runtime.
Can anyone help me?
|
|
|
|
|
Is that what you mean ?
private bool canChange = true;
private object myProp = null;
public void SetProp(object value)
{
if(canChange)
{
this.myProp = value;
this.canChange = false;
}
}
|
|
|
|
|
No
in my UserControl there is a progressbar and progressbar has a Style property and I don't want user of my usercontrol to change this property.
my userControl shuold not have this propery in its properties
|
|
|
|
|
You can just make this progressbar private,or if you need it to be public you may try :
public override myProgress.Style
{
}
|
|
|
|
|
I'm trying to run an example that I found in a book that is for VS 2005.
They use
"using System.Collections.Generic" (which is not there in VS 2003)
and also they use IEnumerable to provide foreach support to a class like this:
public class ClassName : IEnumerable<string>
and then
public IEnumerator<string> GetEnumerator()
{
foeach(){ }
}
I'm not able to tack on the <string> to either IEnumerable or IEnumerator in VS 2003 (to show that I'm returning a string from the foreach function) and I'm wondering if I'm missing including something or if this just cannot be done in 2003.
Thanks
<small>"One of the Georges," said Psmith, "I forget which, once said that a
certain number of hours' sleep a day--I cannot recall for the moment how
many--made a man something, which for the time being has slipped my
memory."</small>
|
|
|
|
|
|
Thank you
"One of the Georges," said Psmith, "I forget which, once said that a
certain number of hours' sleep a day--I cannot recall for the moment how
many--made a man something, which for the time being has slipped my
memory."
|
|
|
|
|
i have problem with .net reflector
the following message alwayes appear
"the version of .net reflector is out of date"
even i update the reflector to most recent version
sorry if this not right form
thanks in advanced
|
|
|
|
|
Hello,
I am developing a web base proj using asp.net(C#). I just wondering how am i going to put it on web. I am using a dynamic dns, do i need to change any settings or configure my IIS? How can i do it??
Please help...
Thanks!!
|
|
|
|
|
|
|
While trying to write a Serial Device Comm app, I came across a class called CommBase written by Jim Hind.
I kept trying to implement it in my app but, kept getting an error about it not being reference or no directive. I then realized that the class description for CommBase was an abstract class.
So I created another class that referenced this one and it work fine. So why would anyone want to do this? I'm not quite sure I understand what an abstract class is, can anyone explain the need for this sort of thing?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
An abstract class is a class that is meant to be derived from by other classes. It is used to provide a single interface that can be implemented differently. While interfaces also provide the functionality, abstract classes allow implementation, so you can have the abstract base class provide a sort of template, with the missing parts filled in by the deriving classes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hey,
Anybody know how to recodr voice from the mic ...???
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
|
Hello,
I have a 1 table with a list of departments, and another table with a list of employees who work in those departments.
What I want to do is select a department from a combo box, and display all the employees who work in that department in a list box.
I am using a dataset and created the data relationship between the 2 tables. My code is as follows:
OleDbCommand cmd = cnn.CreateCommand();<br />
cmd.CommandType = CommandType.Text;<br />
cmd.CommandText = "SELECT * FROM Employee";<br />
da.SelectCommand = cmd;<br />
da.FillSchema(ds,SchemaType.Source,"Employee");<br />
da.Fill(ds,"Employee");<br />
<br />
cmd.CommandText = "SELECT * FROM Department";<br />
da.SelectCommand = cmd;<br />
da.FillSchema(ds,SchemaType.Source,"Department");<br />
da.Fill(ds,"Department");<br />
<br />
DataColumn parentColumn = ds.Tables["Department"].Columns["DepartmentCode"];<br />
DataColumn childColumn = ds.Tables["Employee"].Columns["DepartmentID"];<br />
<br />
ds.Relations.Clear();<br />
DataRelation drEmployees = new DataRelation("EmployeeDetails",parentColumn,childColumn);<br />
ds.Relations.Add(drEmployees);<br />
<br />
foreach employee in departments<br />
Add to the list box<br />
Many thanks in advance,
Steve
|
|
|
|
|
Hi,
Sorry if this is obvious, but...
I'm writing a C# Forms app in VS.NET 2003. I have enabled the XP theme in the form by importing the requisite functions from uxtheme.dll and calling EnableVisualStyles().
To get the style to show on the tab pages, I implemented a paint handler for the tab pages where I call DrawThemeBackground(). (all of this I have gotten from articles here)
All of this works fine, and the tab pages themselves look great, but the problem is that labels and checkboxes on the tab pages, which I have set to use a transparent background and FlatStyle=FlatStyle.System, paint a white background.
I tried creating custom controls, where I inherit from Checkbox and Label, and override OnPaint and do something similar to what I did for the tab page, but it still doesn't work.
Any ideas as to what I'm doing wrong, or missing?
Thanks,
Joe
|
|
|
|
|
have you tired this:
Application.DoEvents();
Steve
|
|
|
|
|
Yes. I had a call to DoEvents() right after calling EnableVisualStyles().
I sprinkled DoEvents() calls liberally throughout the tab page's Paint event handler, as well as in the OnPaint in my custom checkbox control, to see if there is some point in the painting that needed it, but there was no change.
Joe
|
|
|
|
|
You have to put this line immediately after your call to EnableVisualStyles:
Application.DoEvents();
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes, immediately after the call to EnableVisualStyles() I have a call to DoEvents(). And still the label and checkbox controls paint a white background.
Tomorrow I'll post some code snippits.
Joe
|
|
|
|
|
My main function looks like:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.DoEvents();
...
}
And my handler for the Paint event for my tab page is:
private void VisualStyleTabPage_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
Control c = (Control)sender;
IntPtr hTheme = OpenThemeData(c.Handle, "Tab");
try {
IntPtr hDC = g.GetHdc();
RECT rect = new RECT();
rect.LoadFromRect(c.ClientRectangle);
DrawThemeBackground(hTheme, hDC, 10, 0, ref rect, ref rect);
g.ReleaseHdc(hDC);
} finally {
CloseThemeData(hTheme);
hTheme = IntPtr.Zero;
}
}
When I set, for instance, the label control's BackColor to Transparent, it paints a solid white background for the control. So, I created a custom control that inherits from Label, and overrode the OnPaintBackground handler, painting with the same color as the tab page's background:
protected override void OnPaintBackground(PaintEventArgs e)
{
Graphics g = e.Graphics;
IntPtr hTheme = OpenThemeData(this.Handle, "Tab");
try {
IntPtr hDC = g.GetHdc();
RECT rect = new RECT();
rect.LoadFromRect(this.ClientRectangle);
DrawThemeBackground(hTheme, hDC, 10, 0, ref rect, ref rect);
g.ReleaseHdc(hDC);
} finally {
CloseThemeData(hTheme);
hTheme = IntPtr.Zero;
}
}
This paints most of the background of the label control with the correct background, but the horizontal strip where text is present is still solid white.
Thanks,
Joe
|
|
|
|