DotNetOpenAuth OnLoggedIn event never fired - c#

I am a fresher to use the DotNetOpenAuth. And I have download the latest version V3.4.6 from your website which includes samples.
But when I try to test the “OpenIdRelyingPartyWebForms” project, it seems that the “OnLoggedIn=OpenIdLogin1_LoggedIn” event never been fired, so the friendly user name can never be displayed. And I also test the “OpenIdRelyingPartyMvc” project, after I logged in with Yahoo opened, it always give the following information “This message has already been processed. This could indicate a replay attack in progress.” It seems that I can always get this error message.
Further information: I test it in my company then got the above information; but when I go back home, I can successfully use all the DotNetOpenAuth examples and even my own codes with it can work well.
My computer OS in company is: Windows 7
My computer OS in home is: Windows Vista
Maybe the company network environment is different from the network environment at home??? Or maybe it is caused by different OS???
I have seen others to raise a similiar question which is also about "OnLoggedIn" event can not fire, but seems no one reply it.
Can you give any help about this?
Thanks.

I have resolved my problems. I finally found out that it is due to the configuration issue. I just add maxAuthenticationTime="0:10" in the openid section, that is:
"openid maxAuthenticationTime="0:10"",
then I can get the examples run normally. Maybe the default maxAuthenticationTime is less than 10? Maybe in some network environment, it needs more authentication time.
Anyway, thanks for your reply and your excellent work for openid.

It could very well be that your company network has a firewall that blocks something that OpenID needs if your site is on the internal network. Impossible to say what for sure though, being on the outside.
The OS version shouldn't have anything to do with it, however.

Related

Blazor Server application is slow when there is no internet available

In the domain we have two types of networks. One type is allowed to connect to the internet and the other does not allow connections to the internet. The internal network is available to both.
We have a webserver in the network that hosts a Blazor Server application (using iis). The server is in the network that can use the internet. Now when i use my laptop that is also in the network that can connect to the internet, the website on the server is fast and gives me a snappy response. When i open the same site on a computer that is in the network that is not allowed to connect to the internet, the loading speeds are dramatically decreased. We see a slight increase when we set the protocol to http instead of https, but it is not a game changer.
We see that the data is loaded realy fast but the network request takes up to 6.5 seconds and the loading of data 29 miliseconds.
Anyone have any ideas?
We switched the application from https to http. This was a slight increase.
We used wireshark to check the networktraffic but we see the delays in there as well. The connection itself is good not red flags.
We changed the underlying platform of the application from .net 6 to .net 7. This did not make any difference.
We changed the deployment mode from framework-dependend to self-contained. Still no difference.
As soon as we enable the internet for the network, the site is fast again.
UPDATE 26-01-2023
After some more research we figured out that there are two ip addresses that need to be let through to make it fast again. The IP's are 142.250.179.131 and 23.2.226.23. The first IP is an IP owned by Google and has something to do with gstatic, and the second is from a company named Akamai Technologies.
None of the nuget packages or references in the application code reference any of the packages created by Akamai Technologies or Google. Or is there something else i am missing?
Well, if this is the case. I think this also needs to narrow down the scope of this issue. Have you tried to access the site directly using the domain name and port? For this result, you may need to take different actions:
Issue still occurs. Then this problem may be related to the application code development, you need to review the code and troubleshoot.
Issue resolved. Then you may need to check the performance of IIS server. Try to use the Debug Diagnostic Tool and check its performance. Something like this:

C# Smart-client deployment is not working?

I haven't deployed a smart-client in a very long time, so I may be doing something wrong. My publish works well, and the app works for me (could be cached?), but my users can't run the app and instead get this error:
Can't reach this page
Make sure the web address XXXXX is correct
Also, when I browse the page from the server, IE briefly starts like the app is going to run, but then nothing ever comes up. The default document is set correctly.
The app works perfectly locally, so I am sure it is an IIS setup issue.
I am just not sure where to go with this. Can anyone offer a suggestion for troubleshooting steps?
The problem is that my organization (actually, the parent organization over my organization) had decided to block the port I was using. After I convinced them to open the port, all worked as expected.

C# SMTP Mail Error 5.5.1 Only In Debugger

I'm getting the following error when trying to send an email from my C# application, but only when I'm running it in the Visual Studio IDE
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required
If I build my application and install it I do not get this error. I've read through a bunch of similar questions and I've checked all the obvious things, but no existing answer addresses this.
System.Net.Mail SmtpClient and MailMessage
.NET Framework 4.5
Host: smtp.gmail.com
Port: 587
EnableSsl: true
UseDefaultCredentials: false
I know my email credentials are accurate, it's the same ones I use once the application is installed. Something about it trying to send an email from the debugger throws an authentication error.
I'm also pretty sure this used to work. I don't know when it started to fail, and I was too lazy to look into it at the time, but it's growing more and more frustrating. Perhaps I took an update to either Windows or VS that caused it, I don't know.
UPDATE
I wanted to clarify since I've done some more testing. This problem also seems to be related specifically to the app in question. In order to do some testing I created a simple test app that used my same library for email reporting and it works fine in debugger. I have even copied the actual methods from my application into my test app and they work. So there must be something in the app settings that is causing this, but I can't figure it out.
I have resolved this and I wanted to share my experience with the world in case this helps anyone else. I don't know the actual cause of these errors, but I was able to resolve it by poking around and tweaking the project settings of the application. At first I thought perhaps I had conflicting GUIDs that were causing a spam filter to go off, so I starting going through the project settings of the app. While I was there I realized that I didn't actually have a GUID configured for this application and much of the publisher details were all the defaults. I copied the GUID from my ISTool project I use for building it to an installer and I filled out the other important details in the project settings. This caused my settings file to get re-created, so I had to re-configure my app settings, but once that was done email worked. I don't know if this was a safety mechanism to prevent email spamming from hastily thrown together projects or maybe it was blackballed for not having a GUID. Whatever the reason, it seems that accurately filling out the project info makes a difference.
Hope this helps someone else someday :)

Giving windows service permission to write to event logs [duplicate]

My question is related to write permissions to the Windows Event Log.
I have looked around several posts concering this, and have found some ways to solve my problem, but none of these are acceptable for my current scenario.
I use C# in .NET 4.0. I use the EventLog class:
EventLog class
In short, I need to see if there is a way to impersonate or authenticate with an authenticated user and password to reach the right I need to write to the Event Log. The server will always be in the Windows Server family, but the version may vary.
My application is a Windows Service running with one of the following accounts:
Network Service
Local Service
Local System
User with restricted rights (Users or
Domain Users groups)
Here are some other criterias I have:
I cannot put the service user as Administrator, not even local administrator on the server
I cannot edit or alter the registry
I cannot alter the UAC or any group policies on the server
I have a user with Administrator rights, but it cannot be used to run the service
The Event Log will always be the local Event Log, not on a remote machine
The Log will probably always be the "Application" log
The Source may vary, and that seems to be the heart of the problem
My question is : Is this at all possible?
Can I impersonate a user in my code to achieve what I need?
I do that when connecting to web services, logging on to smtp servers and of courseclogging in to databases etc.
I stumbled into this class:
EventLogPermission Class
But I cannot seem to get a good concept on how to use the class.
I hope I have expressed my problem good. I don't concider this a duplicate of another post because of my criterias.
By default, any authenticated user is able to write to application event log. However only administrators can create new event Sources. If all event Sources are known at the service installation time, I recommend register those sources ahead of time, then you will be all set up. Registering is a simple call to EventLog.CreateEventSource.
If you need more flexibility on event sources, you can customize permissions. Those defaults could be customized by tweaking a registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Eventlog\Application\CustomSD
A process described in this KB Article. A wevtutil tool, which is part of OS, available on Server 2008 and above, makes it a bit easier than going through regedit.
The answer showed to be "no".
I realize there are no good way of solving this the way I requested. There must be a manual job done.
So the solution I pick for this scenario is that customers who cannot run the service as an administrator or do a manual registry edit cannot use the functions around logging to event log. And I will make it possible to enable and disable the logging from the config.
Admin user and registry edit are known ways for me, but as stated something I was trying to avoid. But that is, as it seems, not possible according to my criterias this time.

DNS error when trying to connect to Windows Azure Service Bus

The remote name could not be resolved:
'x.servicebus.windows.net'.TrackingId:bbfe86f8-b5d3
Doing an nslookup works fine.
I can hit the url from the browser with no issues.
Usually rebooting resolves the issue. It seems to be the consistent thing, but sometimes even this doesn't work. Sometimes simply waiting until later fixes the issue.
I've tried closing IIS express, resetting my ip, closing visual studio, etc., but nothing immediately resolves it, other than rebooting, but like I said this doesn't always work, so not sure it's even related.
I've tried disabling my firewall. I uninstalled norton anti-virus, but no luck. I've also disabled Windows Defender.
This only seems to be happen on my Windows 8.1 machine. Even when I'm
experiencing the error, I can run the same code from my Windows 7
machine with no problems. I don't use my Windows 7 machine enough
though to know if it is really a Windows 8 specific issue.
Microsoft mentions possibly using Shared Access Signatures as an alternative for connecting to the service bus, but I'm not looking to rewrite my code over what appears to be a possible bug in Microsoft's SDK. Does anyone know how to diagnose this? I am wondering if there are trace logs that can be setup in web.config specifically for the servicebus perhaps that might give me some additional error information. Or if someone else has run into this and can provide some insight.
This does not seem anything specific to the Service Bus APIs, you can get more information on the IP configuration and reset it on you Windows 8.1 box as follows:
Open an administrator command prompt and type the following:
netsh int ip reset
netsh winsock reset
Check if any errors are listed? If not, go ahead and reboot the computer.
This ended up being a server issue on Microsoft's end which is why it was impossible to resolve through code and machine changes. It took awhile for them to get it figured out and resolved. If anyone has a similar issue they may want want to consider this possibility as well and get in touch with Microsoft.

Categories

Resources