w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Com Interop error when using impersonation on ASP.NET
So using the code below worked for me. using System.Web.Hosting; public List<string> GetGroupNames(string userName) { var result = new List<string>(); using (HostingEnvironment.Impersonate()) { using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "NPC")) { using (PrincipalSearchResult<Principal> src = UserPrincipal.FindByIdentity(pc, userName).GetGroups(pc)) { src.ToList().ForEach(sr => result.Add(sr.SamAccountName)); } } return result; } }

Categories : C#

Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on?
As far as I can understand the Thread.CurrentPrincipal contains the information of conditions the thread has been started with, including the WindowsIdentity. That's why Thread.CurrentPrincipal.Identity.Name returns the name of User who started the thread. To the contrary WindowsIdentity.GetCurrent() Returns a WindowsIdentity object that represents the current Windows user, which has been changed via Impersonation. I'm not 100% sure about it, but that's how I think it works.

Categories : Asp Net

OAuth2.0 - How does it protect from client impersonation?
Why you care about user gets an access token? With that token, only data belong to that user are exposed to the app. For the case the user needs to be identified: now that a backend server is already there, code flow can be used also. Both user and client are identified. For the case the user needn't to be identified: is a proxy in the client's backend server acceptable? The access token can be hold only be the proxy, and you can make sure it is a real client. The only problem is the proxy need to check the origin of each HTTP request to make sure it comes from the same domain. The JavaScript application can add some custom headers when sends requests to proxy.

Categories : Api

Send mail using c# interop library without installing outlook client
yes this is possible using C# alone. user does not need to install outlook in client machine. C# provides a namespace called System.Net.Mail. This has all the classes required to send a mail from C#. It does not have any dependency with OutLook. Have a look below code snippet : System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add("jeet@abc.come"); message.Subject = "This is the Subject line"; message.From = new System.Net.Mail.MailAddress("From@XYZ"); message.Body = "This is the message body"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("**yoursmtphost**"); smtp.Send(message); In place of "yoursmtphost" you can configure the Ip address of machine as well. Hope this solves your query. Don't forget to mark

Categories : C#

how to save xsl file in client pc if i am using Microsoft.Office.Interop.Excel
HRESULT: 0x800A03EC is an unknown (to VB.Net) COM error. This usually happens when Excel throws some error because your input or parameters were wrong or didn't work. Also check the error detail carefully. In my case the Data section had an Item that gave me clues about the exact error thrown by Excel. @Erwin says: The IIS user account has to have permissions to write the file. Search for 0x800A03EC in the following article, How to Create Excel file in ASP.NET C#

Categories : Asp Net

Microsoft Office interop perfomance issue
I have a few suggestions to improve the performance. Singly they may not have much impact, but together they should improve overall performance. Hide Excel (if it isn't already) EXL.Visible = false;. Turn off Calculation (Application.Calculation = xlCalculationManual, if it isn't needed) and ScreenUpdating as well. Use Excel.Workbooks.Worksheets rather than the Sheets collection. Rather than looping through all the worksheets, try to reference the one you want, using error-handling to determine if the sheet exists: Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets["SheetName"]; Avoid Select, it is rarely necessary - and slow. Replace, //Select all cells, and clear the contents Microsoft.Office.Interop.Excel.Range myAllRange = worksheet.Cells; myAllRange.Select(); myAl

Categories : C#

Member 'Application' on embedded interop type 'Microsoft.Office.Interop.Excel.Workbook' cannot be evaluated
Please note that I ended up solving the problem by manually copying the data over into a new Excel file and importing that file--I'm still not sure what exactly was wrong with the original Excel file. Thank you to everyone for your suggestions.

Categories : C#

Chrome App - Identity API - Bad client ID NON_NATIVE
(converted from comment to answer per request from another user) When you got your client ID from the API console, did you pick "Installed application" as the application type? The term NON_NATIVE is not appearing in Chromium Code Search, which suggests it's a server error, which suggests it's telling you that you created the client ID incorrectly.

Categories : Javascript

HMAC in client side JavaScript and identity spoofing
JavaScript now has WebRTC where two clients can communicate peer-to-peer, this would be a scenario where clients can generate and use their own "secret". There are some cases where client -> server could be usable as well. If your server was "dynamically" serving the JavaScript then it could insert a "secret" based on the clients current session/login. Assuming you are using HTTPS (if not there could be a man in the middle slurping up the "secret") then it's not unreasonable to assume that communication to the server signed with that specific "secret" (even over unsecured HTTP) belongs to only that client.

Categories : Javascript

Weird HttpContext.User.Identity issue
Your code uses static fields: public class ComplexUserData { public static string complexAccountName; ... Such a static field is shared by all threads, so all users are working on the same data(!) This is very dangerous. static is probably the most dangerous keyword, because the code works but fails weirdly in a multi-threaded scenario and can leak information to other parties. Solution: Don't use static unless you really understand what it does. Never store per-user, per-request or similar information in static variables. Store all user information in the session, in a database or a similar data store.

Categories : Asp Net Mvc

linux wine Word interop application.Documents.Open opens a document in word but does not return the document to the client
This is a known bug in Wine. You can read more here: http://osdir.com/ml/wine-bugs/2013-07/msg01794.html

Categories : C#

Entity Framework to Auto Increment Non Identity Column / Concurrency Issue
You may want to look into a HiLo pattern, or just use Guid.NewGuid() instead of incrementing. See: HiLO for the Entity Framework What's the Hi/Lo algorithm?

Categories : Asp Net Mvc

how to get next Identity not the last inserted identity of Identity column
You don't need to do anything to "lock" an IDENTITY value. As soon as the table uses a value of an IDENTITY, it's used forever, even if you do a rollback. SQL Fiddle example: http://sqlfiddle.com/#!3/5fdb9/1/0. Note the ids that make it into the table, only 1 and 5. If that doesn't address your problem, please revise your question.

Categories : Sql Server

I am configuring simpleSAMLphp with WSO2 4.5.0 Identity server. but getting issue while trying to fetch attributes with saml
When you enable 'Attribute Profile' at the service provider (SP) registration time in Identity Server 4.5.0 (IS), a unique 'Consumer Index' will be generated, and the subsequent SAML requests should contain that value in order IS to send the user attributes in the responses. However, if you want to get the attributes without sending that index value, you can enable "Include Attributes in the Response Always" at SP registration time. This option is available in IS 4.5.0 GA release.

Categories : Wso2

Where is Microsoft.AspNet.Identity.Owin.AuthenticationManager in Asp.Net Identity RTM version?
That class is gone, as it was basically just adding methods that generated a ClaimsIdentity and passed that into an Owin.Security.IAuthenticationManager. Instead the RTM templates have a SignIn method in the controller that looks something like this: private async Task SignInAsync(ApplicationUser user, bool isPersistent) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity); }

Categories : Asp Net

Finding out the current Identity Provider in Windows Identity Foundation
You typically use the Issuer and OriginalIssuer properties in each claim that you get. If you use e-mail as the unique identifier: var u = this.User as IClaimsPrincipal; var c = (u.Identity as IClaimsIdentity) .Claims .First( c => c.ClaimType == ClaimTypes.Email ); var issuer = c.Issuer; var originalIssuer = c.OriginalIssuer;

Categories : C#

How to Alter a table for Identity Specification is identity SQL Server
You cannot "convert" an existing column into an IDENTITY column - you will have to create a new column as INT IDENTITY: ALTER TABLE ProductInProduct ADD NewId INT IDENTITY (1, 1); Update: OK, so there is a way of converting an existing column to IDENTITY. If you absolutely need this - check out this response by Martin Smith with all the gory details.

Categories : SQL

C# Impersonation technique
There are 2 problems with your approach: You are trying to impersonate a remote machine account on a local machine; this won't work. The credentials of a machine account can only be validated by that machine. In addition, that account has no rights on the local machine, so it doesn't really make sense to impersonate it. You need to impersonate a domain account. When you use a tool like putty, the credentials are sent to the remote machine and not validated by the local machine. This is why you can use a machine account of the remote machine. You need to give proper paths for the files. Nowhere do you indicate that these files are on the remote machine. Use something like "\machinec$path ofile". The details on what are going to work or not will depend on your network and OS, whic

Categories : C#

Remote impersonation with UAC
This might be because the remote server has UAC enabled. This means that when you connect to the remote machine, even though you are an administrator, you are stripped of those powers when you operate on the remote machine. There is a Group Policy option that controls this: LocalAccountTokenFilterPolicy Edit: Fixed the link to the proper KB article "Description of User Account Control and remote restrictions in Windows Vista": As to why does it only apply to local admins, and not domain admins? Because that's what the option does - it only limits "members of the local administrator's group": A user who has a domain user account logs on remotely to a Windows Vista computer ..., the domain user will run with a full administrator access token on the remote computer, and UAC will n

Categories : C#

MVC 4 - User Impersonation
First, a word about responsibility. It's our responsibility as developers to inform those that we develop for of potential pitfalls and ethical issues they may be setting themselves up for. Simply giving them what they ask for is not always the right thing to do. In this case, browsing the site as another user can reveal sensitive information to others, and violate user privacy. It can also violate federal law (or law in whatever country you are in) in some cases (particularly when Health information is involved). That doesn't even get into the issues with auditing accuracy. How can you be certain user X actually logged in at this given time if they can be impersonated by another? What if there's a purchase on their credit card? How can you legally guarantee it was them that did it

Categories : Asp Net

Impersonation on windows 7
If it's failing here, FileInfo[] files = dir.GetFiles();, chances are the account you impersonated doesn't have permission to the dir path on the Win7 machine where this is running, make sure that this account has access to the source path first, the impersonation code seems fine

Categories : C#

external ldap client for wso2 Identity Server to authenticate external ldap users
You can check the IS documentation on how to connect to external LDAP server . If you have successfully connected to external store, then authentication will happen against that usertore.. What is the issue you faced when you authenticate with the external LDAP user store? You can file a bug report..

Categories : Wso2

Impersonation in ASP.NET without declaring password
If you want to use user name and password for impersonation you have to store it somewhere. But here is a list of things you can try: Don't store credentials, but ask user to type them in. This will remove maintenance headache from you (user left company, password expired etc) Store credentials in web config using encryption Use Windows impersonation where currently logged in user passes a security descriptor automagically.

Categories : C#

Impersonation and asynchrony in ASP.NET WebAPI
As this answer explained; the impersonation in the web.config overrides the identity in the application pool. In my opinion there is a fine explanation here which one to use: impersonation or application pool

Categories : Dotnet

Impersonation in SQL Server Views?
No, this is not possible. EXECUTE AS is mainly used with SP's, but you can use them a bit more widely. From TechNet: In SQL Server you can define the execution context of the following user-defined modules: functions (except inline table-valued functions), procedures, queues, and triggers. ... Functions (except inline table-valued functions), Stored Procedures, and DML Triggers { EXEC | EXECUTE } AS { CALLER | SELF | OWNER | 'user_name' } DDL Triggers with Database Scope { EXEC | EXECUTE } AS { CALLER | SELF | 'user_name' } DDL Triggers with Server Scope and logon triggers { EXEC | EXECUTE } AS { CALLER | SELF | 'login_name' } Queues { EXEC | EXECUTE } AS { SELF | OWNER | 'user_name' } However, you have some options here: create GET-SP's that

Categories : Sql Server

Windows Impersonation: A Flaw in the Ointment
Thanks to input from Harry Johnston (in comments attached to the question) and Phil Harding (in separate communication) I was able to determine that SQL Server connection pooling was the culprit here. Since pooling is determined by uniqueness of the connection string, by slightly varying the connection string (e.g. reversing order of parameters within, or even just adding a space on the end) I then observed the behaviors I expected. ===== TEST WITH SAME CONN STRING: True BEGIN impersonation Local user: MyDomainmsorens DB reports: MyDomain estuser END impersonation Local user: MyDomainmsorens DB reports: MyDomain estuser <<<<< still impersonating !! ===== TEST WITH SAME CONN STRING: False BEGIN impersonation Local user: MyDomainmsorens DB reports: MyDomain estuser END imper

Categories : C#

Slow performance using local impersonation on ASP
Try changing the way you reference your local server. If your application settings are (local)instance_name update it to (127.0.0.1)instance_name. I’ve had similar performance issue in the past and this fixed it. Note that you’ll need to add this IP address as one of the listeners in SQL Server Configuration manager under Network configuration -> TCP/IP

Categories : Sql Server

What is the magic to Windows impersonation with LOGON32_LOGON_NEW_CREDENTIALS?
The answer, I am ashamed to say, was right in front of me all along. The LogonUser API states: This logon type allows the caller to clone its current token and specify new credentials for outbound connections. The new logon session has the same local identifier but uses different credentials for other network connections. [emphasis mine] But my database is on the same machine as my running program so by definition it will not show the new credentials! I am confident the impersonation will work correctly with LOGON32_LOGON_NEW_CREDENTIALS once I move my database to a different box. Sigh.

Categories : C#

Impersonation succeeds but database connection fails
Your problem come from the connection string. The "Network Library = dbmssocn" in connection string will make client attempting to connect to SQL server on the UDP port 1434 rather than the TCP port 1433. You remove the "Network Library = dbmssocn" from the your application's connection string the application will connect to SQL server successfully.

Categories : C#

How to implement user impersonation in reporting services?
I never worked with services you have mentioned but I hope, following stuff will help you in some way. I used kernal32.dll and advapi32.dll to impersonate user as under: Imports System.Security.Principal Imports System.Runtime.InteropServices Public Class UserImpersonation <DllImport("advapi32.dll")> _ Public Shared Function LogonUserA(ByVal lpszUserName As [String], ByVal lpszDomain As [String], ByVal lpszPassword As [String], ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, ByRef phToken As IntPtr) As Integer End Function <DllImport("advapi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _ Public Shared Function DuplicateToken(ByVal hToken As IntPtr, ByVal impersonationLevel As Integer, ByRef hNewToken As IntPtr) As Integer End Function <DllImport("

Categories : C#

Issue in fetching client MAC ID using Applet
getHardwareAddress requires NetPermission("getNetworkInformation"). http://docs.oracle.com/javase/7/docs/api/java/net/NetworkInterface.html#getHardwareAddress() Therefore a applet jar needs to be signed.

Categories : Java

Issue compiling thrift 0.9.0 c++ client
I tried to fix 0.9.0 by: 1) Install python-dev (I noticed an error: missing python.h when building thrift) sudo apt-get install python-dev 2) Building thrift with: ./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H" Still the same errors, so I decided to checkout, build and install the latest thrift (HEAD version 6f2a5037105ccad05eb84ec0a60da3389c85eb3f in git). With the latest thrift, there were no errors building the cpp client. However, running a.out returned an error: ./a.out: error while loading shared libraries: libthrift-1.0.0-dev.so: cannot open shared object file: No such file or directory Setting LD_LIBRARY_PATH to the newly built thrift library fixed this: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$THRIFT_SRC/lib/cpp/.libs/

Categories : C++

How to disable identity from the existing column & after adding data , how to enable identity again on the same column in SQL Server 2008?
Use SET IDENTITY_INSERT (http://msdn.microsoft.com/en-us/library/ms188059.aspx). SET IDENTITY_INSERT TableName ON; -- Insert Data. SET IDENTITY_INSERT TableName OFF;

Categories : Sql Server

delphi, windows impersonation as user to copy a file
The first suggestion is that you do not have permissions to access the network directory, or the file in question. These could be access permissions or copy permissions (or both). Check that you have permissions to both of these.

Categories : Windows

GetPrivateProfileSectionNames ran in impersonation block returns 0 when ini file is remote
At this point in time, I've not been able to find information about impersonation and how it interacts with win32 dlls/apis, however, I do know the following: 1) if the entire process is running under a user with access to the remote folder the ini file lives in, then GetPrivateProfileSectionNames works as desired 2) if GetPrivateProfileSectionNames is called inside an impersonation block, then it does not work as desired 3) if a file stream is opened, and the ini file is copied local, then GetPrivateProfileSectionNames is used on the local ini file, then GetPrivateProfileSectionNames works as desired, and the file stream is allowed access to the remote file. I speculate, based on results, that the win32 api call GetPrivateProfileSectionNames is not getting passed the impersonation con

Categories : C#

iOS multiple client deployment/distribution issue
Your question is not that specific. Still I think you can keep a webservice to download the server configuration details. and store it in Coredata. Upon user signup you can download the configuration details. Edit: Try the method as Mark Weller said. Check Implementing an iOS Settings Bundle in the doc. If you want to minimize the user interaction, and want to automate the build process. Please check cisimple

Categories : Iphone

Fall back to default user for child processes after impersonation
The simplest solution is for the launching application could make a copy of its own security token and allow the child process to inherit the handle to it. The handle value can be passed on the command line or via an environment variable. Note that this effectively gives User B unrestricted access to user A's account.

Categories : C#

Form client and server side validation issue
What about applying a specific error classes depending if on if js or php error. <span class="jsError">Some Error</span> <span class="phpError">Some Error</span> In your css you would just hide the js errors. .jsError { display:none; } In your js, hide php errors and do your normal jQuery validation there which will show only the js errors. $(function() { $('.phpError').hide(); //after doing your jsValidation show js error only }); This way if js is disabled, only the PHP errors will appear.

Categories : PHP

SSL issue with HttpGet probably because server is requesting client authentication
Could it be the case that Google started expecting certificate from the client? If yes, what should we do? If i understand you right and google truly need certificates, you should use cryptoprovider and make signatures by stunnel. Maybe smth wrong with your code ? This settings are works for me public HttpClient getNewHttpClient() { try { KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null, null); SSLSocketFactory sf = new MySSLSocketFactory(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);

Categories : Java

c# multithreaded server - Generic client collection being a possible issue
Yuo You seem to be asking two questions here You are concerned about managing a collection in a thread safe manner You are concerned about trying to send data over a socket when the other party is disconnected. To answer your concerns given the limited information If you have multiple threads accessing your list then you need a thread safe implementation. You can roll one yourself using lock etc or use one of the new .NET ones. http://msdn.microsoft.com/en-us/library/dd997305.aspx Regarding you comments about "local" lists, the simple answer is do not make local copies unless you want to run the risk of having stale data. Use a thread safe list and also enumerate through it directly. If you use LINQ expressions then you can make complex queries without needing to make any copies of y

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.