|
It's rude to ask the same question again. Also, you've been given the answer in your first post - namely that there's no "proper" solution for what you're trying to do.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello All,
In order to display a combo with all servers on my domain, I am using this code:
string domainName = Environment.UserDomainName;
DirectoryEntry domain = new DirectoryEntry(
String.Format("LDAP://{0}/CN=Computers,DC={1},DC=com"
, domainName
, domainName));
foreach (DirectoryEntry child in domain.Children)
{
this._comboBoxServers.Items.Add(child.Name.Substring(3));
}
domain.Dispose();
At the begining it worked great, until it stoped returning the full list and returns only one computer "BEServer".
When I open an Explore window to look at my network places, in the domain I just retrieved sometime see the all the computers of the domain and sometimes only one icon "UTSC".
Does anybody have a clue ???
Thanks
Calanit
|
|
|
|
|
Maybe someone has a different way to get servers list ?
modified on Tuesday, December 30, 2008 8:35 AM
|
|
|
|
|
I have a project that's web service includes virtual directory and to call the virtual directory in the project ı create an asmx file called 'Directory' and when try to run the asmx on the web, ı got this error.
Besides this, in the project, i declared the virtual directory in the localhost(as in default web site), but i will publish the project, and when users install the program to their pc's, can they see and use the virtual directories in the server. When i research on the web, i see the virtual directory is only in the localhost Can i declare the virtual directories on specified web service like:
"IIS://LocalHost/w3svc/1045426499/Root/Data/",@"c:\Program Files\xxxxx\yyyy\Data"
Could you help me, please!
The error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface.]
[InvalidOperationException: Cannot serialize member 'System.ComponentModel.Component.Site' of type 'System.ComponentModel.ISite', see inner exception for more details.]
System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type) +889837
System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) +134
System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) +129
System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) +1226
System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) +460
System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter) +223
System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter) +460
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) +1415
[InvalidOperationException: There was an error reflecting type 'System.DirectoryServices.DirectoryEntry'.]
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter) +1621
System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +10296
System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +722
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +236
[InvalidOperationException: There was an error reflecting 'GetVirtualDirResult'.]
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +843
System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access) +130
System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate, Boolean openModel, String key, Boolean writeAccess) +223
System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +2989
[InvalidOperationException: Method Directory.GetVirtualDir can not be reflected.]
System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +6527
System.Web.Services.Description.SoapProtocolReflector.ReflectMethod() +91
System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding) +1798
System.Web.Services.Description.ProtocolReflector.Reflect() +703
System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors) +394
System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url) +109
System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri) +156
System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() +284
System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response) +50
System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +77
[InvalidOperationException: Unable to handle request.]
System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +285
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +183
[InvalidOperationException: Failed to handle request.]
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +354
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +193
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
mkn
|
|
|
|
|
I don't know what exactly you wanted to install into Client PC. I think you need to type correct Web Address to call Web Service.
"Http://LocalHost/VirtualDirectoryName/xxxx.asmx"
Visual studio Map virtual Directory automatically.
Another way you can open IIS and then click Map Virtual Directory. You will see your project. Just right click on ASMX file and select show on browser. it should be working.
Thanks
Ali Zishan
London
|
|
|
|
|
hi, i am a new guy for c#.
i have some doubts in c#(windows application) , plz help me
The 1st form include Userid, Password and Login button. when i was enter the userid and password it goes to sqlserver2000 database table (login table) then check the userid and password, the userid has been present sucessfully login, then 2nd form shown else fail.
The 2nd form include one label and button(logout)
In 2nd form how i get (1st form userid)userid for lable.
plz send sampl code....it was very urgent...
by
prabu.m
mailto: prabumps@yahoo.co.in
|
|
|
|
|
Your second form shouldn't know nor access the first form.
When opening the second form you just pass the id to that form.
There are several way's to do this.
1: Make a property on the second form and set this property from the first.
2: Make a constructor on the second form which accepts the id (and use that constructor on the first form)
3: (not to be used unless the id has to be used on several forms) Make a new class with a public shared variable in it and fill that one on the first form. Then access it on the second form
On a side note don't say that it's urgent, all questions are.
|
|
|
|
|
thanks...
but i want sample code for those, bcaz i now only i am learing, so plz send me the code.
|
|
|
|
|
Form2
public partial class Form2 : Form
{
private int iid;
public Form2(int id)
{
InitializeComponent();
iid = id;
}
}
Form1: (opening from form2 is in a button here)
private void btnOpenForm2_Click(object sender, EventArgs e)
{
Form2 frm = new Form2(1);
frm.Show;
}
Now you can use the id anywhere you want on form2
|
|
|
|
|
Hello
I have a requirement to print the images.For small images with the resolution (1024 X 768), print works fine. if the resolution is more. I need to either compress the image or print in multiple pages.
Can you please help me how to compress an image?
Best Regards
Shankar
|
|
|
|
|
Create a rectangle of the appropriate size and draw the image in the rectangle.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
In my application i am using a timer which gets the data for every one minute , but sometimes it is not happening ,its taking more than 15 minutes to call the timer_tick event.I am not understanding what the problem is.In my application i am using multi threading also which handles the another functionality , is this the problem
|
|
|
|
|
may be the data feched by ur application is huge so the processing time is much.
rahul
|
|
|
|
|
hi,
can i see code so i can figer out.
Thanks
Ali Zishan
London
|
|
|
|
|
|
-I have a picturebox 300*300 in size
-And a jpg 1200*1200 pixel 150 DPI
How to draw a quarter of image to picturebox with original size?
Thanks everybody
|
|
|
|
|
Not a quarter but a 1/16th.
How does the JPG exist? Is is a file, a Bitmap instance or what?
Regards,
Rob Philpott.
|
|
|
|
|
First thanks for answer.I load jpg to image object and draw a part of image(size=250*250) in picturebox.
Problem is image was draw in picturebox is smaller than i expect.(because i open jpg by ms paint and i saw 250*250 in ms paint is bigger 250*250 i draw in picturebox).
Hope you can explain.
Thanks.
|
|
|
|
|
Hmm. Not sure, although it sounds like a logical unit vs. device unit problem, possibly taking into account the DPI of your graphics set up.
My graphics card/monitor displays things at 98 dpi, so the scaling might be from the native 150dpi to the 98 (if you are the same), although I would expect things to be bigger than smaller in that case.
The DrawImage method of the Graphics class allows you to scale things, or the ScaleTransform method allows you to change the 'resolution'.
Regards,
Rob Philpott.
|
|
|
|
|
Thank for advise.I will research this problem.
|
|
|
|
|
Hi All,
I have developed an application in c# 2.0
I am going to launch my desktop application in market and I have 2 concerns regarding security of my application
1. Application licensing
2. database security
I don’t want anyone to use multiple installations of my application while he has paid me for 1 license and have a setup, how to prevent it?
I don’t want to show off my sql server schema while I have to deploy a database on client system with user id and password, how to attach an .mdf file with the sql server or anything else so that no one can check my sql database?
Hope you reply soon
Regards
Kaleem Ullah
|
|
|
|
|
LogiSmith wrote: I don’t want anyone to use multiple installations of my application while he has paid me for 1 license and have a setup, how to prevent it?
It is very tough to get a 100% perfect licensing system. I have used APIs from this[^] for my application. They are good and provide a decent way for managing the licenses and activations.
LogiSmith wrote: I don’t want to show off my sql server schema while I have to deploy a database on client system with user id and password
If you want to deploy the DB in user's system, it is very tough to secure it as user will have complete access to it and can hack in easily. Why don't you create a webservice which interacts with database located on your server and your applications interact with this webservice. So users will not have access to databases.
|
|
|
|
|
hi all,
when m modifying appconfig key it just doesnt save it
//my code
<appsettings>
<add key="T" value="True">
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings["T"] != null)
{
config.AppSettings.Settings["T"].Value = "False";
//config.AppSettings.Settings.Remove("DatabaseServer");
}
else
{
config.AppSettings.Settings.Add("Key1", "False");
}
config.Save(ConfigurationSaveMode.Full);
ConfigurationManager.RefreshSection("appSettings");
why is that happening !!!
|
|
|
|
|
Because you can't modify data in the app.config programatically. If you want user-specific data to be saved, you have to use the Settings object.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Your code works for me.
If you're looking for changes in your App.config, you're not going to find them there.
The changes are in the actual runtime configuration file named yourappname.exe.Config,
which will be in the same folder as the exe.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|