Problem with using Context.User.Identity.Name

fog000

New member
Joined
Oct 30, 2024
Messages
1
Programming Experience
10+
Hello,



I have inherited some very old vb.net web forms code. There is a line of code that I've never seen:

Context.User.Identity.Name



I have looked at this and found that it is usually used with forms authentication but we are using windows authentication.

The problem is that we have a rather loose deployment strategy that often uses comparisons between a new code base for an app and the new code base for the app. Not my choice but this involves moving new code to the old code base to build out a new version. Due to this I am almost embarrassed to present this issue but I'm hoping someone has seen this problem.

The problem is that during certain builds that line of code stops working and returns a null. It has been used for years in this app but while I have a hard time knowing what was done during the build, the fact of the matter is that this code is returning nulls. Keep in mind it used to work, at least in the coding I've done with the app. It should return an "ailias" that is associated with the user who logs in and is part of the data also associated with the user who logs in. I am assuming there is some active directory involved with this. However the main problem is that this line of code normally returns something other than null.

As I said, in my research I've found this code is normally used with forms authentication but our web config sets the authentication to "windows".

I've looked around the code and was hoping that there might be a missing import statement or something else obvious but I've found nothing. I appreciate your patience. We are working hard to get someone to create a completely functional version of the code that will run in visual studio as it should. Some of these merges don't run in visual studio but will run in remote servers.

Any help will be appreciated.



Neil
 
Back
Top