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

WebBrowser control not scaled!

$
0
0
Hi,
We use in our software the following control (System.Windows.Forms.WebBrowser). When using the method
ShowPrintPreviewDialog() the print preview dialog appears with a normal scale (96 dpi) correctly.

When the dialog is opened on a screen with a scale set to 250% and a resolution 4K, the buttons (located in header and bottom part) seems to be not correctly scaled.

How can I influence the scaling of this control?

Timer tick event is not firing when it has control has transparent(ControlStyles.SupportsTransparentBackColor, true)

$
0
0
This is a custom control, in which timer tick event is not triggered when it is placed inside transparent panel, this same scenario working fine without transparent color. The timer has started in the button click event of the toolstrip item

     public class CustomControl : Control
    {
        private Timer timer;
        Button element;
        Button starttimer;

        private ToolStripDropDown Popup;
        Point location = Point.Empty;

        public CustomControl()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            Popup = new ToolStripDropDown();
            Popup.Size = new Size(40, 40);
            timer = new Timer();
            timer.Interval = 1;
            timer.Tick += Timer_Tick;
            this.Size = new Size(100, 140);
            element = new Button();
            element.Size = new Size(30, 40);
            element.Text = "set";
            starttimer = new Button();
            starttimer.Size = new Size(30, 40);
            starttimer.Text = "starttimer";
            location = this.PointToScreen(new Point(this.Left, this.Bottom));
            Popup.Size = new Size(210, 210);
            starttimer.Dock = DockStyle.Fill;
            ToolStripControlHost toolHost = new ToolStripControlHost(starttimer);
            Popup.Items.Add(toolHost);
            starttimer.Click += Starttimer_Click;
            element.Click += Element_Click;
            this.Controls.Add(element);
            this.BackColor = Color.Transparent;
        }

        private void Starttimer_Click(object sender, EventArgs e)
        {
            timer.Start();

        }

        private void Element_Click(object sender, EventArgs e)
        {
            Popup.Show(this, location, ToolStripDropDownDirection.Default);
        }

        private void Timer_Tick(object sender, EventArgs e)
        {
            Console.WriteLine("Triggered");
            timer.Stop();
        }
    }

Using CERTENROLL to Create a Certificate Signing Reqest to a CA

$
0
0

Greetings,

I wonder if anybody could shed some light on how to use the CERTENROLL classes (such as CX509Enrollment and CX509CertificateRequestPkcs10) to associate an ALREADY generated CSR to a CA Template. For example, I want to create a website where a user copies a CSR that they already generated into a web app, where on the "submit" button, the web application takes that CSR and associates it to a template (certificate request), and then sends that certificate request for manual approval to our CA.

From my limited testing/researching, I know that both the CX509Enrollment and CX509CertificateRequestPkcs10 classes have various "InitializeFrom" methods (some that use templates, some that don't), but I don't see anything that takes an already generated CSR. (It seems most generate one, which is NOT what I want.)

Any suggestions/feedback would be SUPER APPRECIATED. Thank you.

Getting System.Diagnostics.Eventing.Reader.EventLogNotFoundException exception in some properties of EventRecord

$
0
0

Hi,

I am trying to read windows event logs with EventLogReader. The logs are being read and loaded successfully but for few of the event records i am getting System.Diagnostics.Eventing.Reader.EventLogNotFoundException in properties such as TaskDisplayName and KeywordDisplayName. Can someone help me to rectify this or explain why am i getting this exception.?

Thanks

The type initializer for 'Sap.Data.Hana.HanaConnection' threw an exception

$
0
0

We are using asp.net mvc application to connecte SAP Hana database ussing Sap.Data.Hana.v4.5 dll version Version=2.4.171.0. This dll available on the system where we installed sap b1 client. 

We are getting error at below line:

HanaConnection conn = new HanaConnection();

Could you please help us what causing this issue.

The type initializer for 'Sap.Data.Hana.HanaConnection' threw an exception

The specified module could not be found
Sap.Data.Hana.v4.5

   at Sap.Data.Hana.HanaUnmanagedDll.LoadDll(String dllPath)
   at Sap.Data.Hana.HanaUnmanagedDll..ctor()
   at Sap.Data.Hana.HanaUnmanagedDll.get_Instance()
   at Sap.Data.Hana.HanaConnection..cctor()

clr.dll error cause stop my service

$
0
0

I made a windows service project named "WindowsService-DS".

Then I run it on more than one computer. Then some of them will stop my service with an error, the error modle is "clr.dll" and error code is "c0000005".

It is strange that only three computer have the error. And I can only find "ntdll.dll" error from the system dump file. I have tryied to  restore donet library,but it is not work. "clr.dll" file version is 4.0.30319.17929

It have occured 5 times on three computer, and i have no idea. 

Look forward to your reply

Identity framework token verification

$
0
0

One of my clients is having a problem I'm trying to better understand.  We have an ASP.MVC 5 web application deployed there (been in production for 7ish years).  It uses ADFS for authentication (WS Federation) along with the Identity framework on the .net side. 

First some quick context....

The client shares the servers amongst multiple applications  and the server essentially has each app deployed in a folder off the default web site.

this particular app is located as follows:  https://<base url>/applications/<name of folder>

We're currently trying to move this application to a new set of servers including having it use a newer ADFS server.  Everything else stays the same - same folder structure same folder names, etc.

We have the site running on the new servers including the newer ADFS server.  I can access it from outside of their corporate network and it works exactly as it should.  If I connect to their vpn before trying to access the site, it also works just fine for me (some of their folks have repeated this test and it works for them as well this way)


Here's the actual problem:

If a user tries the same test from inside the network, they are redirected to the ADFS login page and after entering their credentials, ADFS redirects the user's browser to POST to a route in our application.  The payload for this post is the saml payload from ADFS (I think this is a post for .net to verify the token is legit - only a guess though).  What is supposed to happen at this point is the post returns a 302 (chrome says 302 Found) and redirect the user to the landing page of our application.  What it actually does is to return a 302 (chrome says 302 Moved) and redirects the user to the SITE root instead of the application landing page.  At this point, if you try to change the url in the browser to the correct path it quickly redirects you right back to this incorrect url (it at least thinks you have a valid token and skips the ADFS login screen).

In addition to that last redirect being different, the other thing which is different is the ip address for the site.  In both cases we're using the exact same url but  the internal dns is translating that into an internal ip address rather than the public one I use.

so in summary it seems like the first part of the flow all the way through you've entered your credentials into an adfs login page and it authenticates you seem to work consistently in both cases.  It's that very next step where it sends an HTTP POST request with the SAML payload in the request body where it seems to go wrong.  That POST request in both cases goes to the same url in my application but I do not have a controller action in my site to handle a post to the url it's hitting.


.Net Core COM server

$
0
0

I am trying to find a "getting started" making a COM server (in-process) by using .net core (3.1 or upcoming 5) to be consumed by e.g. VBA code in Excel 2016.
I have tried to follow https://docs.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com and managed to compile and seemingly running regsvr32 on the comhost, but there it ends i.e. I don't know how to add a reference to it from excel (or another good-old .net full framework application for that matter), but cannot find it in the list.

I am aware of the notes regarding missing support for generating tlb files, is that the explanation?
Can anyone hint me how to fulfill this last part (my interface is supersimple, just one method with the excel workbook as an argument and returning void.


How to get the category of Windows Update logs?

$
0
0

Hi, 

In Window10, the Windows Update is divided into different categories, such as featrue updates, quality updates etc. The capture of update history page in system is below:

UpdateHistoryInSys

I have already known that I can get the list of updates by this API: IUpdateSearcher::QueryHistory

But how to get the categories of these updates like they are in the red rectangle of the capture? Would someone give me a suggestion?

Thanks.



Blazor Server Authentication not working after publishing to Azure (linux)

$
0
0

https://site.azurewebsites.net/
signin-google
?state=xxx
&code=yyy
&scope=email+profile+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile
&authuser=0
&prompt=none

Sorry, there is nothing at this address.

This error occurs after trying to log in to google in a blazor app after publishing in azure linux (the same did not happen in the windows environment).

logging in normally (user + password) works, but cannot communicate with the API.

app.config versus application settings

$
0
0

I just started using app.config to set certain settings for the application. I would like to give the user the ability to adjust.

I'm able to read app.confgi without any issue but I'm finding it difficult to write new vales back. I then discovered application settings. Since I'm new .Net  I would like to know what is the best option for my needs.

I'm storing approx. five string settings and I have no need to create new ones during runtime. I would like to give the user the ability to edit and save the settings for the next time the program is run.

How to use Microsoft.Media.Capture from a .NET Framework application?

$
0
0
I have an extensive .NET Framework application that is currently using a COM interface to access the IGraphBuilder interface, IMediaControl interface and so on in order to perform image streaming and capture operations from Surface Pro cameras. I want to give the existing Framework application access to Microsoft.Media.Capture functions but Microsoft.Media.Capture doesn't exist in Framework, it's in UWP. How can one bridge from Framework to UWP or Core?

Richard Lewis Haggard


No Binary Format Output?

$
0
0
C# and .NET provide a means of declaring and inputting a binary number, as in 0b_1001_0110, but there appears to be no defined numeric format for outputting a binary value.  One can output a hexadecimal value, as "1000:x8", but there is no "1000:b8" or something similar for outputting binary numbers.  Looks like another format that has to be user-written.

Your project does not reference “.NETFramework,Version=v4.5” framework. Add a reference to “.NETFramework,Version=v4.5”

$
0
0
**Visual Studio Version**:
2019
**Summary**:
I have two framework projects in  same folder, 4.7 framework project has  local Nuget Package reference and   4.5 framework project has  local Assembly reference. The reported issue occurs when run 4.5 project after run the  4.7 projects

Issue:
SeverityCode DescriptionProjectFileLineSuppression State
ErrorYour project does not reference ".NETFramework,Version=v4.5" framework. Add a reference to ".NETFramework,Version=v4.5" in the "TargetFrameworks" property of your project file and then re-run NuGet restore.

**4.7 Project**

```
  <ItemGroup>
   <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
</ItemGroup>
```


**4.5 Project**

    <Reference Include="Microsoft.Xaml.Behaviors.Wpf" xmlns="">
      <HintPath>..\resources\Assembilies\Microsoft.Xaml.Behaviors.dll</HintPath>
    </Reference>



**Steps to Reproduce**:

1.  Run 4.7 project with nuget reference

2. run 4.5 project  with assembly reference

3.  will reproduce the reported issue

How to solve this issue

Microsoft .NET Framework Error every startup

$
0
0

I'm getting this error everytime I startup my pc I don't know what Microsoft .NET Framework is and have never used it, I tried these suggestions: https://answers.microsoft.com/en-us/windows/forum/all/could-not-load-file-or-assembly/d44157d0-4cdb-4ebf-8582-08fa2491d5de , but those didnt work, I also installed Microsoft .NET Repair Tool and I also tried an optional update for .NET and that didn't work either, how do I fix this?:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'RSy3_AudioAppStreamsWrapper.dll' or one of its dependencies. The specified module could not be found.
File name: 'RSy3_AudioAppStreamsWrapper.dll'
   at Synapse3.UserInteractive.ApplicationStreamsEventHandler..ctor(IAccountsClient accountEvent, IApplicationStreamsEvent appStreamsEvent)
   at Synapse3.UserInteractive.HiddenForm.<HiddenForm_Load>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)




************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Razer Synapse Service Process
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Razer/Synapse3/UserProcess/Razer%20Synapse%20Service%20Process.exe
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4200.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 14.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4200.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Deployment
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4200.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
----------------------------------------
PresentationFramework
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4220.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
System.Xaml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4220.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Common.DeviceCallbacks
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Razer/Synapse3/UserProcess/Common.DeviceCallbacks.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


Trouble with p2p connection

$
0
0

Recently I am programming a p2p application with c# socket.

I am forwarding ports with mono.Nat package.

I have some problems with connecting.

Sockets can't connect however I forwarded ports.

I am using my router IP as host IP.

publicstaticSocketPublicStream=newSocket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);Program.availsock.Send(Networkbyted);//how i send

len =TargetSocket.Receive(BytedNetworkString);TargetSocket.Connect(HostIpendpoint);

Here is how I defined my sockets and I am sending by socket.

I am very newbie about sockets. How can I fix this. Please provide me simple explanation.

Thanks.

Why does MeasureString insist extra height is required for text?

$
0
0

I get unexpected results when measuring a string in Windows 10/.NET 4.8/Winforms against a graphics object representing a printer device:

var doc =newPrintDocument{PrinterSettings=newPrinterSettings{PrinterName="Microsoft Print to PDF",PrintToFile=true,PrintFileName="c:\\temp\\test.pdf"}}; doc.PrintPage+=(object sender,PrintPageEventArgs e)=>{var font =newFont("Verdana",8,FontStyle.Regular);var format =newStringFormat{Alignment=StringAlignment.Near,FormatFlags=StringFormatFlags.LineLimit,LineAlignment=StringAlignment.Near,Trimming=StringTrimming.Word,HotkeyPrefix=HotkeyPrefix.None};var text ="0ZG0XLLJ620";var size = e.Graphics.MeasureString(text, font,newSizeF(300,1000000), format); size = e.Graphics.MeasureString(text, font,newSizeF(size.Width,1000000), format); e.Cancel=true;}; doc.Print();

The height component of size becomes larger on the second call to MeasureString, and the width smaller. Shouldn't the returned size be the same on both calls, especially since the second has been passed an available space wide enough to accommodate the text?

Note, this doesn't happen in Windows7. In fact, you can work around the problem by overwriting the Windows 10 Verdana with the one from Windows 7.

Binance Customer ☎️+1800⇚547⇚6109 ☎️ Service phone number()

$
0
0
most advisors didn’t run their business in an on-demand way, it became a crutch for the collective group, with few advisors feeling enough heat that it would force them to evolve. But now, if someone can join an online yoga class from their living room, why can’t they receive information from their advisor in a similar way, through contemporary means like videos, blogs, and infographics?The point is, there’s tremendous opportunity right now for advisors who want to stand out. They accomplish this by evolving their practice to support spending more time and energy on client service and business development.For us, as an asset manager, there’s a parallel opportunity. It’s that we can stand out from our peers by accelerating our focus on helping advisors manage their businesses.

Binance Customer ☎️1844︽903︽2945 ☎️ Service Helpline number

$
0
0

Since the beginning of Bitcoin in 2008, we at Trend News have been suspicious of digital Binance capacity to endure, given that they present an extremely clear danger to governments who need to see and assessment all exchanges. Yet, while we may in any case be wary on the real Binance forms of money, we are mindful of the capability of the fundamental innovation that controls these electronic monetary standards. Truth be told, we accept that this innovation will be a huge Binance in how information is overseen, and that it will affect each segment of the worldwide economy, much like how the web affected media.

Binance ™Support Number ☎️+ 𝗜𝟖𝟒𝟒-𝟗𝟎𝟑-𝟐𝟗𝟒𝟓 ☎️ Phone Number

$
0
0

Binance are virtual monetary forms that exist in huge circulated information bases. These information bases use Binance  innovation. Since each Binance information base is broadly appropriated, it is believed to be resistant to hacking, as there is no essential issue of assault and each exchange is noticeable to everybody on the system. Every CC has a gathering of executives, regularly called "excavators", who approve exchanges. One CC called Binance utilizes "brilliant agreements" to approve exchanges. Binance TREND will give more subtleties in up and coming news distributions.

Viewing all 8156 articles
Browse latest View live


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