|
jon_80 wrote: but what is the ASP.net acct used?
Depends on the server being used. If it's the development web server that comes with Visual Studio, it's "ASPNET". If it's IIS 6.0 and below, it'll probably be something like "IUSR_machineName". For IIS 7.0 and above, I think this name got changed to just "IUSR".
|
|
|
|
|
This method should work for you.
public static void AddFileSecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
{
try
{
// Create a new FileInfo object.
FileInfo fInfo = new FileInfo(FileName);
// Get a FileSecurity object that represents the
// current security settings.
FileSecurity fSecurity = fInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
fSecurity.AddAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));
// Set the new access settings.
fInfo.SetAccessControl(fSecurity);
}
catch (Exception exp)
{
Console.WriteLine(exp.Message.ToString());
Console.Read();
}
}
You can use it with something like this:
FileWritePermission.AddFileSecurity(path, "everyone", System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow);
Cheers
|
|
|
|
|
Cute code, but an account (and core running under that account) cannot grant more permissions to itself, nor anyone else, than it already has.
|
|
|
|
|
Good morning everybody,
I would like to show stocked data in ListView to send DataTable aprés Select. DataTable contains a colonne of type Byte [] Array, I do not succeed show pictures in gate.somebody address can help me SVP?
|
|
|
|
|
I think that I understand what you want to do. If I am right, this[^] link should help you.
If I am wrong, please edit your original post and try to explain you problem more clearly.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Good morning,
Excuse me, I am French, I speak the language badly Englishman. My question is the following:
I have one banks on look at foundation of data which contains columns Name, Forename, Photograph
I make a request SQL which is the following:
cmd.CommandText ="SELECT NAME, FIRSTNAME, PHOTO FROM USER";
I fill ListView in the following way:
sqlDa = new SqlDataAdapter();
sqlDa.SelectCommand = cmd;
try
{
sqlDa.Fill(dt_ListeUtilisateur);
if (dt_ListeUtilisateur.Rows.Count > 0)
{
lstUtilisateur.DataContext = dt_ListeUtilisateur.DefaultView;
}} //lstUtilisateur = ListView
XAML :
<listview margin="7,10,15,48" name="lstUtilisateur" itemssource="{Binding}" borderbrush="{x:Null}" listboxitem.selected="lstUtilisateur_Selected" selectionchanged="lstUtilisateur_SelectionChanged">
<listview.view>
<gridview>
<gridviewcolumn header="NAME" displaymemberbinding="{Binding Path=NAME}" selector.isselected="True">
<gridviewcolumn header="FIRSTNAME" displaymemberbinding="{Binding Path=FIRSTNAME}">
<gridviewcolumn header="Picture" width="100" displaymemberbinding="{Binding Path=MyImage}">
<gridviewcolumn.celltemplate>
<datatemplate>
In the column Picture of my ListView, I have unfortunately not the photograph but Byte [] Array you can help me please.
|
|
|
|
|
Good morning,
Excuse me, I am French, I speak the language badly Englishman. My question is the following:
I have one banks on look at foundation of data which contains columns Name, Forename, Photograph
I make a request SQL which is the following:
cmd.CommandText ="SELECT NAME, FIRSTNAME, PHOTO FROM USER";
I fill ListView in the following way:
sqlDa = new SqlDataAdapter();
sqlDa.SelectCommand = cmd;
try
{
sqlDa.Fill(dt_ListeUtilisateur);
if (dt_ListeUtilisateur.Rows.Count>0)
{
lstUtilisateur.DataContext = dt_ListeUtilisateur.DefaultView;
}} //lstUtilisateur = ListView
XAML :
<listview margin="7,10,15,48" name="lstUtilisateur" itemssource="{Binding}" borderbrush="{x:Null}" listboxitem.selected="lstUtilisateur_Selected" selectionchanged="lstUtilisateur_SelectionChanged">
<listview.view>
<gridview>
<gridviewcolumn header="NAME" displaymemberbinding="{Binding Path=NAME}" selector.isselected="True">
<gridviewcolumn header="FIRSTNAME" displaymemberbinding="{Binding Path=FIRSTNAME}">
<gridviewcolumn header="Picture" width="100" displaymemberbinding="{Binding Path=MyImage}">
<gridviewcolumn.celltemplate>
<datatemplate>
In the column Picture of my ListView, I have unfortunately not the photograph but Byte [] Array you can help me please.
|
|
|
|
|
Your English is quite good. Part of what you are trying to do, is what I thought from your first post, so it must be reasonable.
I must admit that I didn't read all of the link I gave, but I thought that it dealt with reading and saving images to and from a database. If that is not where your problem is, then can I suggest that you post in the WPF forum here on CP, as your application would seem to be a WPF one.
If loading the photo is your problem, then perhaps you might like to Google for yourself. The search term I used was 'Loading Image from SQLServer C#', to see if there is anything more appropriate.
You seem to be slightly annoyed by my suggesting that you re-word your question. You shouldn't be, I often find that trying to ask something using different words makes me understand it a little better, myself.
Anyway, Good Luck! (Bon chance ????)
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
I have a byte[] to unit function, I would like to have a reverse function that convert unit to byte[], please help. thanks a lot.
public static uint ParseUint(byte[] buffer, int uintLengthInBytes, ref int offset)
{
uint value = 0;
int i, j;
for (i = offset + uintLengthInBytes - 1, j = 0; i >= offset; i--, j++)
value |= (uint)(buffer[i] << (8 * j));
offset += uintLengthInBytes;
return value;
}
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|
|
hi, I know that method, the result is wrong. please take a closer look at the original code
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|
What? Is it in Big Endian or something? Just Array.Reverse the result?
|
|
|
|
|
sorry, my debugging mistake, you are right. thanks a lot.
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|
|
Byte order reversal?
Use System.BitConverter and System.Net.IPAddress.NetworkToHostOrder/HostToNetworkOrder.
One I did earlier:
internal void WriteUInt32(UInt32 i, Int32 ofs, Byte[] buffer) {
Int32 j = IPAddress.HostToNetworkOrder(unchecked((Int32)i));
Byte[] b = BitConverter.GetBytes(j);
b.CopyTo(buffer, ofs);
}
Alan.
|
|
|
|
|
Nice! I'm going to remember that one
|
|
|
|
|
present, and according to data availble as packet by packet.
I want to read the html elements obtained and change the innertext of each html element. I am able to do all these.
The main thing is I want the changed text should be visible to user directly instead of original text which is obtained in packets.
How can I do this?
If I had to use threading, How can I do that?
or If I can user timers, how can I do this?
Say correct solution. If there are any examples, it would be so much helpful for me...
|
|
|
|
|
|
the //error? line needs to be in a class definition but not inside of a function
|
|
|
|
|
Hi There,
I am Using FFMpeg in my project and it was great going. I am struck in a position where I need to fetch the Time when a blank screen comes in between a video file. It will be great if you help me in this Issue.
Thanks & Regards
|
|
|
|
|
You're going to have to find a forum specific to the library you're using. What you're asking has nothing to do with C# or the .NET Framework at all.
|
|
|
|
|
hi everybody
i m using C# Application
i have a 'date' and 'days' columns in datagridview
now i want to findout the no. of days between two dates
how can i calculate
pls help me
date days
--------------------------------------------
1/11/2008 0
1/12/2008 30
3/12/2008 2
--------------------------------------------
modified on Monday, May 4, 2009 9:32 AM
|
|
|
|
|
Example :
DateTime d1 = new DateTime(2008, 1, 1);
DateTime d2 = new DateTime(2009, 1, 1);
TimeSpan ts = d2.Substract(d1);
ts.TotalDays <- is the value you want.
|
|
|
|
|
Hello,
I use dataadapter to fill datagrid (using datatable).
dataAdapter =
new SqlDataAdapter(selectcommand3, connectionstring);
But my sql query command is too long. because i receive an error that sqlexception was unhandled (incorrect syntax near '='). But when i write another much shorter sql query it works fine. What can i do to solve it?
|
|
|
|
|
Use stored procs
only two letters away from being an asset
|
|
|
|