|
Help you with what? You haven't asked a question. All you did was provide a short list of what you want to do with insufficient detail about the platform you're using, specifications on the size of the data sets you're dealing with, which grid control you're using, blah, blah, blah, ...
So, given the complete lack of detail in your question, the only answer anyone can give you right now is, "Permission granted! Please, proceed."
|
|
|
|
|
Hi,
while sending SOAP envelope with xml content to the recipient service with credentials e.g(userName ,Password) i am not able to send the request.
I am just having IP addreess and Port of the recipient.
Below code I am using for that :
string username = "XXX"
string Password = "YYY"
string Methodname = "ABC" // Method Provided
//Converted string in Base 64 format for username & password
var headerFormat = "Basic {0}";
var authHeader = string.Format(headerFormat,
Convert.ToBase64String(Encoding.UTF8.GetBytes(Uri.EscapeDataString(username) + ":" + Uri.EscapeDataString(Password))));
//web request made for SOAP
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(“https://192.168.0.1:11111/”);
req.Headers.Add("SOAPAction", "https://192.168.0.1:11111/" + Methodname );
//Authorization added to SOAP web request header.
req.Headers.Add("Authorization", authHeader);
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
req.GetRequestStream()
Please help to sort out this problem.
Thanks and Regards,
Rahul Joshi
|
|
|
|
|
vaibhavData wrote: i am not able to send the request.
Why are you "not able to send" it? Are you getting an exception? What exception and where?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I am getting the below exception on webrequest.GetRequestStream()
Inner Exception Message :
A connection attempt failed because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond
192.168.0.1:11111”
|
|
|
|
|
i want the detail about memory mangement in dot net with example.
|
|
|
|
|
Try the documentation[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Good day!
How to make the gradient of the arc, such as an ellipse, the color changed depending point on the ellipse from a certain point.
WPF technology, i use to draw DrawingContext
|
|
|
|
|
If you're just wanting to draw an arc in WPF, you can use this[^] code. Where WPF is really clever, is in its ability to allow you to easily swap brushes around. You might want to use a LinearGradientBrush in the Stroke , to satisfy your need for a gradient.
|
|
|
|
|
|
I have some code that checks a remote machines service to ensure it is all good. It installs as a service which I have tested as local system and network service and I get the
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
error. if I manually add a user to the application it works fine here is the part of code I am using to try to pass the alternate credentials any help would be appreciated
ConnectionOptions op = new ConnectionOptions();
op.Username = "xxxxxxx";
op.Password = "xxxxxx";
op.Impersonation = ImpersonationLevel.Impersonate;
op.EnablePrivileges = true;
ManagementScope scope = new ManagementScope(@"\\192.168.1.103\root\cimv2", op);
scope.Options = op;
SelectQuery query = new SelectQuery("SELECT * FROM Win32_Service WHERE Name =" + servicename);
using (ManagementObjectSearcher ser = new ManagementObjectSearcher(scope, query))
{
ManagementObjectCollection services = ser.Get();
foreach (ManagementObject service in services)
{
}
}
|
|
|
|
|
Andre O Rahming wrote: if I manually add a user to the application it works fine here is the part of
code I am using to try to pass the alternate credentials any help would be
appreciated
sorry, I dont get that bit
Are you using Active Directory at your site ? - 'in loose terms', I'd create an AD profile witht he appropriate permissions, that can be used on each machine, and the service uses it and your service checker gets 'run as' the 'service profile' (that would have to be a safer way, rather than requiring hard-coded accounts/credentials in code)
'g'
|
|
|
|
|
Have a look at the user account under which you are running the service.
This account may not have access to WMI.
|
|
|
|
|
Also check that the account has access to network resources. I am not sure, Local System may lack them, try Local Network Service.
|
|
|
|
|
Hi,
I'm very new in c# code. I would like to have a list a windows that open in current desktop in window z order.I have go through the internet and found this code
public partial class Form1 : Form
{
public const int GW_HWNDNEXT = 2;
public const int GW_HWNDPREV = 3;
[DllImport("user32.dll")]
static extern IntPtr GetTopWindow(IntPtr hWnd);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "GetWindow", SetLastError = true)]
public static extern IntPtr GetNextWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.U4)] int wFlag);
public Form1()
{
InitializeComponent();
}
public static Form GetTopMostWindow(IntPtr hWnd_mainFrm)
{
Form frm = null;
IntPtr hwnd = GetTopWindow((IntPtr)null);
if (hwnd != IntPtr.Zero)
{
while ((!IsWindowVisible(hwnd) || frm == null) && hwnd != hWnd_mainFrm)
{
hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
try
{
frm = (Form)Form.FromHandle(hwnd);
}
catch
{
}
}
}
return frm;
}
}
My question how to get the GetTopMostWindow() return value from form1() class?
Thank you 
|
|
|
|
|
bunge-bunge wrote: My question how to get the GetTopMostWindow() return value from form1() class?
Form1.GetTopMostWindow(Application.MainForm.Handle);
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I'm at a loss for what this is supposed to be? Ever seen this pattern before?
[Serializable]
public class MyCollection : ArrayList {
public enum MyUpdateFields {
MyGroupName
}
}
So, that's basically an ArrayList that defines a useless enum? Why even create this in the first place? I would not even know this exists if Code Analysis hadn't complained about it.
|
|
|
|
|
Jasmine2501 wrote: So, that's basically an ArrayList Basically, yes. The author should be complimented for writing a specific collection-class, as opposed to using generics throughout the app for each collection. It makes changes easier, as one can easily change the collection-class, without having to check each method that uses the collection.
Jasmine2501 wrote: that defines a useless enum? I'm not sure whether it's "useless"; it's merely defined in the collection-class, implying that it's used there, or in conjunction with that class. If it's not used (place the cursor there an hit F12 to find all references) than it'd be better to remove it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I don't see the point in having an Enum that only defines one value. What possible purpose could that have? I can make it private and the app still builds - nobody is using it, and I posted all the code for the class, it's not using it. My concern is not about the unused code though, it's about and Enum with only one value. How do you think that might be used? It can only ever have one value, and it can't be null. I don't see the point. I was kind of wondering if it's done for some reason I've never heard of - a lot of this codebase is copied straight from the MSDN.
I agree that sometimes a named class that doesn't extend the "system" class makes sense. However, I don't have any issues with using ArrayList, if that's what you need. It is a waste of code and a useless increase in complexity - I don't need my own special ArrayList class, the system one is fine. I agree with what you're saying, but I don't think it's enough of an advantage in most cases. "Don't use the generic class" is often used to increase complexity for no reason at all. When the code is not very well documented, it puts me in the position of "OK, I see this class doesn't do anything extra from ArrayList, so why is it here?" and I can go and look at places where it's used and it's doing nothing special, and then I think "certainly the guy before me didn't write extra code just because someone told him not to use the generic classes" - sends me down a rabbit hole of trying to understand reasoning I didn't participate in.
In this question, I'm looking for someone to say, "oh yeah, that's the Lipshitz design pattern, here's a link"
|
|
|
|
|
Jasmine2501 wrote: What possible purpose could that have? Was it in one of their examples? Isn't it just there as a proxy for "you could hypothetically have a enum here.."?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I don't know where they got it from. I only had access to the previous developer for 'not long enough' and he showed me only the things he thought were important. He would be happy to admit that he has zero experience with ASP.Net - the site was converted from PHP, so it has some weird patterns and an overall odd style.
|
|
|
|
|
It's not a useless enum! The enum is simply scoped to the class MyCollection (a terrible name, if that's the actual name). So you can do stuff like this (for example). It's assumed that Foo has a member of type MyCollection.MyUpdateFields .
MyCollection coll = new MyCollection();
Foo f = new Foo();
foo.UpdateField = MyCollection.MyGroupName;
coll.Add (foo);
It's too bad the author hasn't commented their code. (This wouldn't even be accepted for a code review where I work).
/ravi
|
|
|
|
|
I can see in your sample code that you have created a variable of the enum type, and set the value to be the only possible value for that enum - that is all fine and good, but what are you going to use that value for? Remember, setting values that don't get used is a waste of memory - the compiler even warns you about it sometimes.
And yeah, I've changed the names to protect the innocent.
|
|
|
|
|
It's an example to demonstrate enum scoping.
/ravi
|
|
|
|
|
Could you explain what you mean by that? Or point me to a link, Google isn't finding anything with that term.
|
|
|
|
|
By scoped enum, I simply mean an enum that's scoped to a class. See the answer to this[^] SO question.
/ravi
|
|
|
|