Problem while reading a smartcard in browser - c#

I have been using the PCSC library for years to read smartcards and have never had a problem.
I entered the same code, which I do not report because it is too long and is 100% functional, in an ASPX page. If I run the web application from Visual Studio 2019 on localhost everything is fine, if I run it on the server with Windows server 2019 essential I receive this error:
The Smart card resource manager is not running.
I don't understand why this difference. Thanks to those who can help me.
P.S. I don't know Java, but only c#
UPDATE. The SCardSvr service is started on the server, but when I use the PCSC class the service stops on its own on the server. Strange behaviour.........

UPDATE
Based on the new information the OP wants to connect a Smart Card Reader that resides on a remote computer (the client).
To the best of my knowledge this requires either a VNC or an RDP connection from the client to the server, use of the smart card redirection mechanism, and then opening the ASPX webpage from a web browser session started during the remote desktop connection.
My answer below is not applicable in this scenario at all.
OLD ANSWER
I would first look at the Services list on the server computer. Ensure that both Smart Card service and the Smart Card Device Enumeration Service are running when you attempt the request.
This problem may also occur due to insufficient privileges on behalf of the user account running the application pool for your ASPX page.
When you run the web page from Visual Studio 2019 it executes using derived credentials (most likely your own user account), and this account may have more privileges than the specified application pool user account on the Windows Server 2019. This applies especially if you use Application Pool Identities.
If the problem is caused by lack of privileges, then see this ServerFault answer for details on how to use the sc.exe tool to configure the privileges.
Also note jdweng's comment: if you have not installed the necessary drivers for the smart card reader to the Windows Server 2019 computer then you will need to do so in addition to configuring the privileges. Otherwise even though the ASPX page were able to access the Smart Card Resource Manager, the card reader itself has not registered there-in and thus cannot be used.

Related

Access local DB on user pc from a remote application running on "Azure Server"

I am fairly new with MS Azure and developing remote apps.
Have read and viewed some learning stuff.
I use c# as my developing language, and as I have understood, its fairly simple to develop a windows application to run on an Azure server as remote app, which users anywhere on earth can run from their pc as if it was installed locally on their pc's. But in reality, it is more like, an RDP hiding behind the app.
The problem is that a database will be running on every users pc instead on the azure server. It is suppose to be like that by design, don't ask me why.
We tend to use "ms access" for the local DB, since everyone already have MS Office.
Anyway, back to the problem. What I am wondering is, how can I make my remote application on azure server communicate with the database installed locally on user(s) PC?
I have drawn a simple figure to explain what I mean.
http://snag.gy/ybyed.jpg
Back in the days when people used Modems to connect their PC's to the tubes, this would be theoretically possible (although maybe not a good idea). Nowadays, very very few PC's are connected directly to Internet.
In an Office, a PC will be connected via the company intranet to an external gateway and the PC will not be visible to anyone outside that gateway. The same is true at home, where the gateway is the router.
It would be possible with a lot of work to allow external access (from Azure) to the individual PC, but it would not be easy to set up. Further, you would need to write a piece of software to run on the PC which will listen on the correct Port for calls from Azure, will then run the appropriate SQL queries, and return the data to Azure. You might as well install SQL Server full edition on each PC.
Even if you do that, no security professional is going to let you actually open up the ports and firewalls to the internet; it's a lot of work doing that and you might as well just install random viruses on the PC - you'll get to the same point but faster and with less wasted time.
TL;DR: Not easy without a significant investment, and your PC will probably get trashed if you do.
This is actually possible by the magic of RDP protocol :)
Azure RemoteApp supports redirection for Windows machines as documented here: https://azure.microsoft.com/en-us/documentation/articles/remoteapp-redirection/
So, once you create an Azure RemoteApp collection, you can download the PowerShell cmdlets, enter your subscription ID and then you can enable drive redirection. This results in the local disk being mapped on the remote machine. You can try it out and see if performance is good enough.
The other alternative is that the database lives in an Azure storage account, as documented here: https://azure.microsoft.com/en-us/documentation/articles/remoteapp-anyapp/ .
You should NEVER store data on the Azure RemoteApp local machine.
/cd

WPF Window is not Opening from IIS [duplicate]

I want to run an exe on client system from my c# asp.net website. When I use Process.Start()
it throws an error:
The requested operation requires elevation.
How do I set permissions to run that exe?
You can't spawn processes on the client machine from server-side code.
When you use Process.Start in server-side code, it is attempting to execute the process there, on the server where the website is hosted. If you wanted to create processes on the clients computer then you would need to expose a download for them (and not in employing subterfuge, like malign sites might do to install software - supply it gracefully, and normally (and with permission)), or a Silverlight application or something along those lines.
The bottom line is that the code you want to execute (even if that is just to spawn a process) must reside on the client, and be executed there.
You can't run an application from a web server like that. You will have to have the user download the application by supplying the EXE, a setup file or using ClickOnce.
Or you can develop an ActiveX control that you can have the browser automatically download from a Trusted Internet Zone.
Once downloaded, proper signing with a certificate (signed from the trusted (corporate) root certificate) will avoid the user getting a prompt to ask whether he wishes to allow the ActiveX control to install/be activated -
The ActiveX control can subsequently do anything the interactively logged on user could. This means that to actually install a program you'd need to elevate (UAC on Vista+); But if the goal was just to run a standalone executable, you should be good to go.
This all assumes white-hat purposes in a (larger) corporate setting, because it relies on PKI infrastructure and central browser policies, to name just two.**
This would, really, lead to some excellent questions on serverfault or superuser
I noticed you said you wanted to run an exe file on the client, but you didn't say explicitly that the exe is on the server and you want to push it to the client. Everyone seems to be assuming that is the case.
You CAN accomplish this fairly easily with a small JavaScript if you have a few prerequisites:
The executable is already present on the client machine.
All of your clients are running IE
You can enforce a policy to put your site in the Intranet or Trusted
Sites zone.
So basically this means it's a corporate intranet application. I am assuming this is probably the case since, well, if you were expecting to do this with a public app, I would be surprised.
For the script to accomplish this, please see my answer to this question:
How can I get a program on a client machine to run from an ASP.NET page?

designing Client Server Application in C#

designing Client Server Application in C#
I'm developing an application for copying and creating files between local network shares in 1 GB connection. This application will run on a local machine with that connection.
Now I have to introduce a Client-Server connection in a way that the User can perform the same steps from his Home PC. For that reason I have to setup a Server on the local machine which has 1GB connection to the network shares and access that server application from Home to perform the same actions as the User is on his local workspace.
Once again I want to clarify that the application now is running well on a local PC with 1 GB connection. I want to reach as much as possible to that via with the Client-Server. And once again, I'm not copying files from the Client to the Server or anything like that. It is only interaction between the local shares. So I want to be able to perform a copy function from local/share1/folder1 to local/share1/folder2 from the Home PC.
I'm new to Client-Server applications. And I have no idea how to set up that. Any recommendations/suggestions are welcome. My current application is developed in C# Visual Studio, so I believe that I should better use .NET Remoting or some other already supported by Visual Studio. All I could find on the internet is how to set-up a client server application for chat, I see nothing similar to my case.
Any design decisions or code will be really helpful at this moment.
There is no need to attach snippets of my code (I guess), because the application is already running locally and I don't have to change it.
Thanks in advance!

What is an event broker? and how do you configure one on windows 2008?

I am trying without complete success to create a wso2 identity server on a windows server 2008 vm. I followed the online instructions and installed the pre-requisits (jre and jdk), downloaded the zip file, setup the environment variables, and ran the wso2server.bat file. There were a lot of errors.
I then realized I needed to add active directory role on the server, which I did. It still wouldn't install. I did some more online research which led me to believe I needed to install wso2 esb as well, which I did. I was able to get that install to work and was able to create a desktop app to consume the web services. All well and good. but then as part of the requirements they wanted to enable passive sts with an asp.net client (not really sure what that is), so I went back to the identity server and am still getting errors while running the bat file, though I an able to run the gui from the browser, but unable to log in.
The exception I am getting is :
TID: [0] [IS] [2013-10-07 10:34:58,746] ERROR {org.wso2.carbon.event.core.internal.builder.EventBrokerHandler} - Can not create the event broker {org.wso2.carbon.event.core.internal.builder.EventBrokerHandler} org.wso2.carbon.event.core.exception.EventBrokerConfigurationException: Can not access the user registry
in addition, I am also getting authentication errors on some of the esb web calls, but not all, and I would also like to know how to change from the default user store (ldap or ad or whatever it is) to sql server.
I have seen a few examples for doing it with mysql and oracle, but not sql server, specific product information is sometimes challenging to find.
Any help would be greatly appreciated.
Thanks. Mike

"Program can not display web page" error while taking snapshot HtmlCapture.Net

I have an ASP.NET web application developed in Visual Studio 2008 which uses HtmlCapture.Net (www.polestarsoft.com/products/htmlcapture-net/) to take snapshot of some pages.
For example, application has to take snap shot of this page:
http://www.yillikfabrikasi.com/KullaniciYillikSayfasiVersion2ResimlerArkaPlan.aspx?username=bolatug#gmail.com&yillikId=ab05ab4c-138b-4332-b4ca-78484bae5b3e&refresher=31b8ff91-00a0-4122-bea8-87efd879ad83
It was working fine until I moved the application from Windows Server 2003 to Windows Server 2008 (64 bit). Now all images the program takes includes the error message "This Program cannot display webpage" instead of the actual page. You can see how it should be in the link above. here is the picture the application takes
I tried to configure the app pool to DefaultAppPool with identity set to Local System account and the classic app Pool with the same identity. Both configurations fails to take the snapshot.
I have logged the URL used to take the snapshot and I can see the correct page in a browser and take a snapshot with the HtmlCapture.Net application. So I am sure the URL is correct.
What could be the reason for this problem? I think some configuration or security issue prevents the HtmlCapture.Net dll from opening the URL. But I don't have any idea how to fix it. So any opinion is appreciated.
That component seems to use the installed webbrowser (IE) via ActiveX or similar.
Windows Server 2008 has (compared to Windows Server 2003) enhanced security on several levels... including:
IE enhanced security configuration
Different security model for IIS
Different security model for Windows Services (which IIS happens to be)
etc.
Any of the above might lead to the behaviour you see... IMHO it is best to contact the vendor of the component regarding system configuration...
An alternative is to use a component wich does not suffer from the above mentioned aspects - namely does not use IE or ActiveX for that functionality... there are some components (mostly commercial) out there... IF that is an option for let me know - I can post some links...

Categories

Resources