Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

Login to a remote desktop using MSTSCLib

$
0
0

I am trying to log in on a remote desktop. I am able to open the login screen with the following code. (rdpSP is a Microsoft Terminal Server Client Control - version 1)

rdpSP.Server = "the IP";
  rdpSP.Domain = "the domain";
  rdpSP.UserName = "the username";
  MSTSCLib.IMsTscNonScriptable secured = (MSTSCLib.IMsTscNonScriptable)rdpSP.GetOcx();
  secured.ClearTextPassword = "the password";
  rdpSP.Width = this.Width;
  rdpSP.Height = this.Height;
  rdpSP.Connect();

Now I can see the login screen and the user domain/username. But the password isn't used. Is it possible to log in automaticly or at least fill in the password?


Login to a remote desktop using MSTSCLib

$
0
0

I am trying to log in on a remote desktop. I am able to open the login screen with the following code. (rdpSP is a Microsoft Terminal Server Client Control - version 1)

rdpSP.Server = "the IP";
  rdpSP.Domain = "the domain";
  rdpSP.UserName = "the username";
  MSTSCLib.IMsTscNonScriptable secured = (MSTSCLib.IMsTscNonScriptable)rdpSP.GetOcx();
  secured.ClearTextPassword = "the password";
  rdpSP.Width = this.Width;
  rdpSP.Height = this.Height;
  rdpSP.Connect();

Now I can see the login screen and the user domain/username. But the password isn't used. Is it possible to log in automaticly or at least fill in the password?


Compiler Error Message: CS0246: The type or namespace name 'CartelServices' could not be found (are you missing a using directive or an assembly reference?)

$
0
0

I am hosting my web application into godaddy.com.

If i write whole code inside single page then it works fine but if i make it modular and try to use namespace my class library then this error comes.

Error on this page : http://cartelsolution.com/4.5.1/cartelsolution/school/Login.aspx

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0246: The type or namespace name 'CartelServices' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 11:     public partial class Login : System.Web.UI.Page
Line 12:     {Line 13:         CartelServices.CServices services = new CartelServices.CServices();Line 14:         protected void Page_Load(object sender, EventArgs e)
Line 15:         {

If i use my namespace by using CartelServices; then i get same error.


Why BitVector32 uses Mask instead of direct indexing ?

$
0
0

I have an instance of BitVector32. why should i have to access BitVector32 by Mask instead of index? what is the implementation purpose behind mask ?

 

            var bitVector32 = new BitVector32();

            var mask1 = BitVector32.CreateMask();
            var mask2 = BitVector32.CreateMask(mask1);
            var mask3 = BitVector32.CreateMask(mask2);
            var mask4 = BitVector32.CreateMask(mask3);

            var result = bitVector32[mask4]; // Here mask4 value is 8. Instead of using 4 to access 5th index why am i using mask?

Anyone pls help me to understand the reason behind this implementaion ?


Asynchronous Programming ?

$
0
0

Can anyone please explain the difference between Asynchronous Programming and Background threading(ex: new Thread(action) {IsBackground = true}.Start();) ?

what exactly makes Asynchronous programming to be different from Background threading ?

how to integrate ms project with asp.net in c#

$
0
0
Can any Refer me with the solution for creating a project management File using ASP.NET-C#

Google Drive API

$
0
0
using System;
using System.Threading;
using System.Threading.Tasks;

using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Google;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v2;
using Google.Apis.Drive.v2.Data;
using Google.Apis.Services;
using Google.Apis.Util;

namespace GoogleDriveSamples
{
    class DriveCommandLineSample
    {
        static void Main(string[] args)
        {

            Console.WriteLine("Informe o nome do arquivo!");
            string Nome = Console.ReadLine();

            File body = new File();
            body.Title = Nome + ".txt";
            body.Description = "A test document";
            body.MimeType = "text/plain";

            byte[] byteArray = System.IO.File.ReadAllBytes("document.txt");
            System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);

            DriveService service = new Autentificacao().BuildService();
            FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, "text/plain");
            request.Upload();

            File file = request.ResponseBody;
            Console.WriteLine("File id: " + file.Id);
            Console.WriteLine("Press Enter to end this process.");
            Console.ReadLine();
        }
    }

    public class Autentificacao
    {
        private const string SERVICE_ACCOUNT_EMAIL = --SERVICE_ACCOUNT_EMAIL--;
        private const string SERVICE_ACCOUNT_PKCS12_FILE_PATH = --SERVICE_ACCOUNT_PKCS12_FILE_PATH--;

        public DriveService BuildService()
        {
            string serviceAccountEmail = SERVICE_ACCOUNT_EMAIL;
            string Caminho = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            var certificate = new X509Certificate2(Caminho + SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret", X509KeyStorageFlags.Exportable);

            ServiceAccountCredential credential = new ServiceAccountCredential(
               new ServiceAccountCredential.Initializer(serviceAccountEmail)
               {
                   Scopes = new[] { DriveService.Scope.Drive }
               }.FromCertificate(certificate));

            var service = new DriveService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Drive API Sample",
            });

            return service;
        }
    }
}

Hello people, what's wrong in my code. In my account i can see in the analytic it's work, but i don't know where is txt. I have to insert the txt in my own account.

Thanks.

Microsoft.VisualBasic.Information.IsNumeric() return false for UInt32 type

$
0
0

Hi,

I have been searching around this topic but surprisingly, I cannot find any related topic or reported bug. It totally blows my mind. Is this actually a bug or there is a computer-scientific reason behind this behavior? And how senior am I to be able to report a bug to Microsoft system because it looks like it is heavily restricted.

Thanks.


Selecting Office version To Open Word Document

$
0
0

Dear All,

I am coding a simple application that opens a word document a windows form application.

The code is simple:

(Reference has been added to Microsoft.Office.Interop.Word version 12.0)

Public Sub Load()

Dim    ObjWord as   Word.Application

try

  ObjWord = New Word.Application

  ObjWord.Documents.Add()

  ObjWord.Visible = True

catch ex as exception

Finally

end try

End Sub

My problem is the following :

I have both versions of office installed : 2007 and 2010, I need a way to make word open in any of the versions ( it is actually opening in 2010 format).

Your help is much appreciated.

AutoFac : Multiple containers

$
0
0

I have a MVC application, and i am using Autofac to resolve dependencies.

I have a situation where i create 2 containers and runtime should decide which container to use based on a condition.

The condition is if the controller Home is called, i need to use container1, or else i have to use container2.

I am not sure how to make this happen at runtime.

I am registering from the Global.asax which should return the container that i have to use eventually.

Thanks,


Lakshman

Problem to write access HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video

$
0
0

First of all, I did search the entire forum but didn't find useful answer can solve my problem.

Here is my development tools and test environment information.

  • Visual Studio 2013 with Update 3
  • Windows Form desktop application with .NET Framework v2.0
  • The language I am using is C#
  • I tested with both Windows 8.1 and Windows 7 and run into same problem

I am a graphics driver engineer and want to develop some tools for internal usage. .NET Framework give me the fastest way to create a decent GUI tool and this is reason why I choose it.

As I am working with graphics driver, I need update the keys under "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video".

However, I run into the problem with the following line of code,

RegistryKey theVideoKey = Registry.LocalMachine.CreateSubKey(theKeyStr);

The error message is:

An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

Additional information: Access to the registry key 'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Video\{????}\0000' is denied.

I tried everything I think could be useful found on the forum, such as "run as Adminitrator" but it doesn't work. Please help.

ConfigurationManager is broken by mistake

$
0
0
I broke configurationManager by mistake . I just tried to secure my connectionstring, but now I am not even able to get normal human readable connectionstring from configuration manager, I just tried some commands in vs2012 command prompt like aspnet_regiiis pef ....bla bla bla , and now when I just try to get connectionstring from configurationmanager it just brings         connectionstrings from webconfig file located in c:/windows/microsoft.net/framework64/4.0303/web.config i made a very annoying mistake ,Plaese Help

Extracting cad file(.dwg) data in visual studio 2010(using c# asp.net)

$
0
0

I need to extract the drawing(.dwg) file content using visual studio 2010(c# asp.net).For this i have to own the third party product/dll but i dont know which one is good among

1)RealDWG

2)CAD imported .Net

3)CadLib

Can any one suggest me

Regards

Honnappa M S

it is being by another process when copy file from local disk to folder in domain network why

$
0
0

Hi guys i have problem in my code when i try to copy image jpg from local disk in any place to network path domain

it give me error the process cannot access the file it using by another process file

why this message show

and how to solve

my code as below 

Opening a docx document in IE

$
0
0

Dear All,

My goal is to open a .docx document in a web browser.

I have downloaded the OpenXML viewer for internet explorer, thus if I drag a .docx document and drop it in Internet Explorer browser, the file content are displayed on the page.

However, if I try to load the file into a webBrowser control (C# or vb.net) using the webbrowser.navigate("filepath"), the file opens on as separate word office document.

I have been looking for solutions without success,
some say we should add a registry entry for the application within  to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"

Ref: http://stackoverflow.com/questions/15874565/how-to-set-ie9-by-default-for-web-browser

Any Help is much appreciated.


ValidateCredentials work around for Bug?

$
0
0

Does anyone else been able to confirm the COM release bug on the PrincipalContext.ValidateCredentials() and come up with a work around?  When using a ContextType of Machine to validate a local user's credentials after a computer has been disconnected from a network, the exception "The network path was not found" is raised. 

Specifically, I've been able to identify that this issue only occurs when a computer which was connected to a network and successfully made a ValidateCredentials() call then disconnected and attempts  to make a second call will see this error message.  If the machine is booted up disconnected from the network the ValidateCredentials() functionality works as expected (albeit the code under the hood looks like a hack).

var context = new PrincipalContext(ContextType.Machine, "localmachinename");

context.ValidateCredentials("LoginUID", "LoginPassword");

From what I can tell ADsOpenObject() call used the activeds.dll API to call IntADSOpenObject (as ADsOpenObject) which returns a double pointer to the interface IADsOpenDSObject (see blue arrow for double pointer).  This is then cast as an IADs interface on the managed side of the house in order to call the Get("name") method.  When the network is connected this will raise a COMException which then throws the GetExceptionFromCOMException() which appears to be squashed as it never bubbles out of the ValidateCredentials() call (see green arrow).  When the network is connected then disconnected the COMException never occurs and the code goes directly to the finally block.  When the code attempts to release the COM Object is when the exception happens (see red arrow).

I was using the .NET Reflector generated PDBs to debug this code so it's possible that the managed code was optimized away and my stack trace is not completely accurate.  In anycase, this is definitely a .NET Framework BUG since the logic works without network connectivity from the get go, just not after the machine has been connected to the network.

I'm using an XBAP application so I'm also trying to stay away from directly using COM and having to marshal back and forth across managed/unmanaged boundaries.

Any suggestions?

UPDATE:

OK, so I'm completely stupefied.  I just took a few huge chunks of the code from the System.DirectoryServices.AccountManagement namespace and created a local class with the key bits for PrincipalContext and ran through the scenarios above so I could debug some of the internal classes, interfaces, structs, etc. and I can't duplicate the issue AT ALL.  I've commented out a few sections that I didn't want to have to resolve (i.e. StringResources for exception messages and objects that have no bearing on the ValidateCredentials call being tested).  In both scenarios where the network is connected and disconnected, the ppObject.Get("name"); call is successful, no COMExceptions are thrown and the Marshal.ReleaseComObject works as expected. 

UPDATE 2:

OK, so I may have misspoke on the last update.  It appears to be a timing issue and I wasn't waiting long enough.  I would hazard a guess that something is being cached and not being released when the network is disconnected but after some arbitrary amount of time, things start to fail again


SignalR and ASP.NET gridview

$
0
0

Does anyone know how to update an ASP.Net GridView in real-time using SignalR?

The scenario is:

- I got a database table.

- The GridView is being populated with data from the table.

- Once the data is updated on the table, the GridView is updated at real-time using SignalR.

Can anyone help and advise on this one?

Tlbimp.exe not generating the output dll that starts with InterOp word

$
0
0

Hi,

I am Creating InterOp dll using the below syntax:

tlbimp.exe ABC.dll \out:Interop.ABCLib.dll

The output Interop dll name should be Interop.ABCLib.dll, but i am getting it as ABCLib.dll. The word 'Interop' is not generated.

Please let me the correct command which generates the Interop dll that i have mentioned above. Thanks in advance.

Regards, Chetan.


Chetan Rajakumar

Type.GetTypeFromProgID does not work for remote server

$
0
0

Type.GetTypeFromProgID does not seem to work when remote server is specified, when the ProgID is not registered in the local server. I think it is a bug. I could not find any reference about the solution for this. The framework we tested is 4.5.1. 

Any idea of when this would be fixed?

asp.net gridview row_created event

$
0
0

Hi

I have two questions regarding asp.net gridview

1 Why row_created event is fired before pageload when I sort a column in gridview ? I kept allowsort=true and binding grid from code behind using datasource property.

2 Why I am not able to retrieve gridview.sortexpression and gridview.sortdirection in gridview_rowcreated event or gridview_sorted event ?

 


Viewing all 8156 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>