|
There has to be another place in your code that is registering 8001 or 8002. Set debug breakpoints or output some text letting you know when a channel is about to be registered. The only time this message would occur is if a channel has already been registered on that port.
Tech, life, family, faith: Give me a visit.
Judah Himango
|
|
|
|
|
When you think your program has exited clean, start a command prompt an type:
netstat -a
Look in the output for a "TCP computername:yourportnum..."
If you find an entry for one of your ports, then something is still running.
|
|
|
|
|
Is there any method to append to a string, here's what I'm doing:
<br />
string selectString = "SELECT * FROM table_name WHERE ";<br />
<br />
if(programName.Text != null)<br />
{<br />
}<br />
Any ideas?
|
|
|
|
|
Have you looked at the StringBuilder class?
|
|
|
|
|
If you are trying to append the string in a loop or trying to do a lot of appending, use the StringBuilder class. Otherwise just use
<br />
selectString += "Whatever text to be appended";<br />
Regards
Senthil
|
|
|
|
|
Apart from all that - I would never, never build SQL like this. To be honest, I'd never build SQL at all in my middle tier, I'd put it all in stored procedures.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
I went ahead and used the += syntax for now as I'm reading up on stored procedures as I write this (pretty talented eh? :-P)
thanks for the advice all.
PS - is there an informal rule to go by as to when to use stored procedures or to use StringBuilder?
|
|
|
|
|
why can't u try to insert
by writing:
this.yourText.insert(); // and these parameters have the starting index which will be your string's textLenght-1 and your additional string
ByMindOnlyYouCanDoIt
|
|
|
|
|
never, Never, NEver, NEVer, NEVEr, NEVER(!!) use string concatenation to build SQL statements. All your doing is teaching someone how to get themselves fired from a developer job. Instead, teach them the best way: stored procedures and parameterized queries.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When I use System.Diagnostics.Process to launch a console app such as NAnt, the process hangs whenever the memory it uses exceeds some arbitrary amount.
In the NAnt example, this command line will execute to completion without errors: "NAnt.exe -buildfile:Some.Build -logfile:Some.log"
But this command line will hang and NAnt will not compile anything:
"NAnt.exe -verbose -buildfile:Some.Build -logfile:Some.log"
<br />
System.Diagnostics.ProcessStartInfo _StartInfo = new System.Diagnostics.ProcessStartInfo(command, commandParameters);<br />
System.Diagnostics.Process _Process = new System.Diagnostics.Process();<br />
_StartInfo.WorkingDirectory = workingDirectory;<br />
_StartInfo.RedirectStandardOutput = true;<br />
_StartInfo.UseShellExecute = false;<br />
_Process.StartInfo = _StartInfo;<br />
_Process.Start();<br />
TIA for any help.
|
|
|
|
|
|
|
try to write a webmethod written in C# which has to use a method imported from a dll written in C++.
public char[] stringa;
[DllImport(<dll_name>)]
public static extern int RPC_GetStringa( ref char[] stringatest);
[WebMethod]
public int RPC_GetStringaWs()
{
int j = -1;
stringa = new char[127];
try
{
j = RPC_GetStringa (ref stringa );
return j;
}
catch (Exception e)
{
return j;
}
}
on the other side (C++) RPC_GetStringa accepts just a array of 127 char.
It's doesn't work.. The exception is: "Can not marshal parameter #1: Ansi char arrays can not be marshaled as byref or as an unmanaged-to-managed parameter." }
Any suggestions will be very appreciated! Thanks in advance.
Paolo Leoncini
|
|
|
|
|
I'm using a ListBox without the scrollbar and I want to have a visual indicator to show that there is more item on the top or on the bottom of the ListBox.
For the top I use TopIndex, but for the bottom ? BottomIndex doesn't exist.
So, how to know the last visible index of a listbox ?
Thanks
|
|
|
|
|
I found a way with IndexFromPoint.
|
|
|
|
|
I'm using MAPI33 wrapper DLL in my C# program to read mails from Outlook/Exchange. I was using
the wrapper to avoid the popup messages thrown by the Outlook message guard and it almost workd
till I started reading attachments from a message. I was able to retreive attachment
size/number/name properites but was unable to open any of them. I'm facing problems with
IAttachment interface exposed by the wrapper.
This is how I'm trying to read attachments:
IAttachment tempAttach;
hr = msg.OpenAttach(intAttachNum,Guid.Empty,
__MAPI33__INTERNALS__.Message.FLAGS.DeferredErrors,
out tempAttach);
Above code gives a pointer to the Attachment object.
MAPI33.IUnknown stmUnKNown;
hr = tempAttach.OpenProperty(Tags.PR_ATTACH_DATA_BIN,
Guid.Empty,0,
__MAPI33__INTERNALS__.MAPIProp.FLAGS.DeferredErrors,
out stmUnKNown);
Above code is giving two types of errors depending on the Flag property i.e., for some I'm
getting "Invalid Property" and for others "Errors Returned."
Pls point me to any examples or additional information.
|
|
|
|
|
I have a client application that successfully uses a singleton remote object hosted on a seperate server. Recently I have changed the same client application to also use a second singlecall remote object. The two objects are exposed through two seperate channels. During develpment the singlecall object was on the same machine as the client application.
I mannged to get this working but when I move the new object to another machine it no longer works. All I get is an internal error message on the client saying to turn customErrors on in the server. However doing so chnages nothing.
Any ideas where I'm going wrong?
|
|
|
|
|
Maybe it's got something to do with the machine's CAS policy? Did you try setting the TypeFilterLevel to full?
Regards
Senthil
|
|
|
|
|
I am Logon user to create the impresonate user. When the run the code on windows 2000 I am getting the message "A required privilege is not held by the client."
Can any one let me know what privalages has to set.
For reference I am attaching the code also.
[assembly:SecurityPermissionAttribute(SecurityAction.RequestOptional, UnmanagedCode=true)]
[assembly:PermissionSetAttribute(SecurityAction.RequestOptional, Name = "FullTrust")]
[DllImport("advapi32.dll", SetLastError=true)]
public static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword,
int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
[DllImport("kernel32.dll", CharSet=System.Runtime.InteropServices.CharSet.Auto)]
private unsafe static extern int FormatMessage(int dwFlags, ref IntPtr lpSource,
int dwMessageId, int dwLanguageId, ref String lpBuffer, int nSize, IntPtr *Arguments);
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public extern static bool CloseHandle(IntPtr handle);
[DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public extern static bool DuplicateToken(IntPtr ExistingTokenHandle,
int SECURITY_IMPERSONATION_LEVEL, ref IntPtr DuplicateTokenHandle);
public unsafe static string GetErrorMessage(int errorCode)
{
int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;
int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
//int errorCode = 0x5; //ERROR_ACCESS_DENIED
//throw new System.ComponentModel.Win32Exception(errorCode);
int messageSize = 255;
String lpMsgBuf = "";
int dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
IntPtr ptrlpSource = IntPtr.Zero;
IntPtr prtArguments = IntPtr.Zero;
int retVal = FormatMessage(dwFlags, ref ptrlpSource, errorCode, 0, ref lpMsgBuf, messageSize, &prtArguments);
if (0 == retVal)
{
throw new Exception("Failed to format message for error code " + errorCode + ". ");
}
return lpMsgBuf;
}
string userName;
userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
MessageBox.Show(userName);
IntPtr tokenHandle = new IntPtr(0);
IntPtr dupeTokenHandle = new IntPtr(0);
tokenHandle = IntPtr.Zero;
dupeTokenHandle = IntPtr.Zero;
const int LOGON32_PROVIDER_DEFAULT = 0;
const int LOGON32_LOGON_INTERACTIVE = 2;
bool returnValue = LogonUser(textBox1.Text, textBox2.Text, textBox3.Text,
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT,
ref tokenHandle);
somebody please help me
|
|
|
|
|
From the documentation[^]:
Windows 2000: The process calling LogonUser requires the SE_TCB_NAME privilege. If the calling process does not have this privilege, LogonUser fails and GetLastError returns ERROR_PRIVILEGE_NOT_HELD. In some cases, the process that calls LogonUser must also have the SE_CHANGE_NOTIFY_NAME privilege enabled; otherwise, LogonUser fails and GetLastError returns ERROR_ACCESS_DENIED. This privilege is not required for the local system account or accounts that are members of the administrators group. By default, SE_CHANGE_NOTIFY_NAME is enabled for all users, but some administrators may disable it for everyone.
SE_TCB_NAME is known as "Act as part of the operating system" in the privilege-setting user interface. It's only given to the SYSTEM/LocalSystem account by default.
Since you don't say what you're trying to do, it's difficult to help further. If you want to create a process running under a different user account, try CreateProcessWithLogonW[^].
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks Mike,
This is the first time I am working on the windows security can you please let me where to set the SE_TCB_NAME and SE_CHANGE_NOTIFY_NAME privalage.
I need the User name, Password and the Domian name to provide it for a windows services developed by me. I am using "this accont" option in the properties dialog of the service manager as I have to access few protected resource on the system.
While installing the service in the for the first time I need to give these deatils. So I have UI which will query for the User name and the password then I would want to validate the user name and password before mounting and starting the service.
My initial idea was to use logon user function, if it succeeds then the credential entered are correct and I can continue to start the service.
Is there any other alternate method of doing this. Please help me
thanks and regards
Sharath
|
|
|
|
|
sharathgowda wrote:
This is the first time I am working on the windows security can you please let me where to set the SE_TCB_NAME and SE_CHANGE_NOTIFY_NAME privalage.
That's why you need to read the documentation he linked. Those privileges are granted to users through the security configuration of the machine or domain (which applies to the machine). It's all covered in linked documentation from the documentation you were given.
You do not need to use LogonUser to prompt for the username and password, however. You only need the credentials. If you want to authenticate that the credentials are correct than calling LogonUser is by far the easiest way to authenticate them.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello...
I have some problems with my tabcontrol. I would like to make it transparent, but I cant....is there any way to make the tabpages AND the tabs transparent? If there is a way to do this, please help me..
//Carnilmo
|
|
|
|
|
Hi all,
Are there any good third-parties UI control components for .NET ?
I want to use them to re-decorate the view design of my project.
Thanks
|
|
|
|