I checked them, but they just made me wonder if there's a less confusing solution
All I really want is the current user's login name. But I cant use WindowsIdentity.GetCurrent() because there are some cases where calling that from the control will return a different user than calling it from the code behind (which has the value I need). I thought if I could get HttpContext.Current it would have the right value, but that plan kind of relied on it being easy to do
It only works 99% of the time. There's a chance it returns the wrong user because of how the web app works. I'd explain but that would be boring. The point is the code behind for the page would know the right user 100% of the time so I thought getting at the HttpContext might be a solution. Maybe there's some other way to see what the code behind sees
It's a windows forms control embeded in an aspx page. Kind of like an activex control. It's separate from the web app. It seems to run under a different process. And I'm trying to obtain the username of the logged in user currently accessing the web app or page or something
Uri uri = new Uri("http://mysite.com/");
ICredentials credentials = CredentialCache.DefaultCredentials;
NetworkCredential credential = credentials.GetCredential(uri, "Basic");
string user = credential.UserName;
Is your website using IIS Setting--Anonymous Access/Authentication?
If so, try disabling and turn on Integrated Windows Authentication, then retry your call to: System.Web.HttpContext.Current.User.Identity.Name
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
I am writing a java program that needs to execute shell commands, so I wrote a function that would take the command to execute as a string (ie: "mkdir ~/Folder1") and execute that command with the shell. Here is the function:
Runtime run = Runtime.getRuntime();
Process pr = ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.