String url = new Uri(@"http://test.com/%2c").ToString();
In .net 4.5 and .net 4.5.1, it still output 'http://test.com/%2c'.
But in .net 4 it will output 'http://test.com/,'.
String url = new Uri(@"http://test.com/%2c").ToString();
In .net 4.5 and .net 4.5.1, it still output 'http://test.com/%2c'.
But in .net 4 it will output 'http://test.com/,'.
I am writing a program that spawns child processes and those child processes need to use a credential that is not local on the machine when accessing network resources I need to spawn those processes with the LOGON_NETCREDENTIALS_ONLY flag. I want to use the System.Diagnostics.Process library since I already have a huge investment into it and it's wired up with intercepted IO. Is there any way I can tell Process internally to use the LOGON_NETCREDENTIALS_ONLY flag when calling CreateProcessWithLogonW when credentials are provided? Since the account does not exist locally on the box I will get access denied without the flag in play. I've looked everywhere and the only solution I've found is to implement CreateProcessWithLogonW which means I have to also interop all of the stream interaction code and everything else already wired to the Process object and I would like to avoid that if it at all possible. Even if there is a way to inherit Process and add the flag that way I could go that route, I just need advise.
Thanks,
Jerry
Dev
I am using Unity Interception to handle logging. I would like to use the IMethodInvocation target property, but it causing a stackoverflow exception. It seems that by referencing this property, it is intercepted again.
How can I prevent this?
I am able to reference other properties, such as MethodBase without this behavior.
Any Ideas?
public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext)Bill Behning
public static byte[] Encrypt(byte[] content, X509Certificate2Collection encryptingCertificates) { if (content == null) { throw new ApplicationException("NullContent"); } if (encryptingCertificates == null || encryptingCertificates.Count == 0) { throw new ApplicationException("NoCertificates"); } CmsRecipientCollection recipients = new CmsRecipientCollection(SubjectIdentifierType.IssuerAndSerialNumber, encryptingCertificates); EnvelopedCms dataEnvelope = new EnvelopedCms(new ContentInfo(new Oid("1.2.840.113549.1.7.1"), content), new AlgorithmIdentifier(new Oid("2.16.840.1.101.3.4.1.2"))); dataEnvelope.Encrypt(recipients); return dataEnvelope.Encode(); } public static byte[] Decrypt(byte[] encryptedContent, X509Certificate2Collection decryptingCertificates) { if (decryptingCertificates == null || decryptingCertificates.Count == 0) { throw new ApplicationException("NoCertificates"); } EnvelopedCms dataEnvelope = new EnvelopedCms(); dataEnvelope.Decode(encryptedContent); dataEnvelope.Decrypt(decryptingCertificates); ContentInfo contentInfo = dataEnvelope.ContentInfo; return contentInfo.Content; }
CryptographicException: Access denied. at System.Security.Cryptography.Pkcs.EnvelopedCms.DecryptContent(RecipientInfoCollection recipientInfos, X509Certificate2Collection extraStore) at CertificateTestingTool.CertificateResolver.Decrypt(Byte[] encryptedContent, X509Certificate2Collection decryptingCerti ficates) at CertificateTestingTool.Program.Main(String[] args)
public static X509Certificate2Collection GetCertificates(string certPath, string password) { X509Certificate2Collection certs = null; var logger = Log.Logger; certs = new X509Certificate2Collection(); certs.Clear(); var flags = X509KeyStorageFlags.DefaultKeySet; certs.Import(certPath, password, flags); return certs; }
We've run into a weird problem where a query executed using OracleCommand returns more (duplicate) rows than the exact same query executed in SQL Plus.
More specifically the query in SQL Plus returns 9 rows while the query using OracleCommand.ExecuteReader() returns 12 rows. The additional rows are duplicates of 3 of the 9 previous rows. The result set is the same each time.
It's a simple select on one table with filtering on three of the columns. This problem has occured with two of our customers and we've not been able to replicate them in our testing environment.
Anyone experienced this problem?
Kind regards,
Christoffer
We are getting sporadic errors saying below stack trace from app logs, the same web service are used by many vendors and It gives proper responses for most of the times, but when some client call the WS repeatedly It gives below error after some time and after within seconds the next call get successfull results
Pleas let me know what would be the exact cause
MESSAGE1: The security token could not be authenticated or authorizedHi,
Im using .Net Framework 3.0.
I have a SupplierApproveDataContext that inherits from System.Data.DLinq.DataContext.
I have this class:
public sealed class SupplierApproveDI
{
//private static readonly SupplierApproveDataContext instance;
static SupplierApproveDI() { }
private SupplierApproveDI() { }
public static SupplierApproveDataContext Instance
{
get
{
return new SupplierApproveDataContext();
}
}
}
I use the datacontext like:
result = SupplierApproveDI.Instance.Supplier_ChangeStatus(obj.OrgID, newSupplierStatusId, uId);
where Supplier_ChangeStatus executes a stored procedure like:
StoredProcedureResult result = this.ExecuteStoredProcedure(((MethodInfo)(MethodInfo.GetCurrentMethod()))
, orgId, supplierStatusId, createdBy);
I want to know when my data context instance close or is it not closing and leaving all the instance open and hanging?
Any suggestion would be appreciated.
Thanks and Regards,
Christian
Hello,
I have a vb.NET 4.0 Web application that allows my Institute's teachers to select their classroom number then, if their students are playing games or surfing on the internet during the teaching time, to force theirs computers to switch off and to inactivate theirs accounts so they can’t log (by setting userAccountControl to 514).
Then, once the teacher as finished his talking, he can log on on my application, choose their classroom number then click on a button to unlock the students’ accounts (by setting userAccountControl to 512).
This app works just fine; however, as you can imagine, it happens that the teacher leaves the classroom without thinking of unlocking the student’s accounts….And every time it is me who has to do that. Just crazy.
I’m trying to find a way to lock the students accounts just for something like 1 or 2 hours and then automatically unlocking these accounts. I found what I thought to be a nice Active Directory attribute called lockoutDuration which is said to set the amount of time a count has to be locked before unlocking it. But I can’t find it amongst my AD attributes.
I tried looking for a WMI class to let me do this kind of thing. I didn’t find one. However, the Active Directory user properties dialog box has on the Account tab a check case to tell the system the Account is locked out…So this attribute must exist somewhere on the WMI Classes?
I tried Looking for a PowerShell 3 script but nothing.
I thought about creating a SQL server trigger but I need this trigger to execute some .net code not immediately but after 1h or 2, and I don’t know whether a trigger can do that (wait for a long time after it’s called before execute a code).
Could anyone have an idea about what can be done?
Thanks a lot,
Have a nice day,
Susana
susana
I couldn't find any good examples of how to use ChangeMonitor classes.
Here's my problem: I'm caching a few method of my Repository, building a key to uniquely identify the cached data. The cached data has a expiration time, but the data can change before the expiration takes place.
Take a look:
public class CachedUserRepository : CachedRepositoryBase, IUserRepository { private readonly CacheKeyBuilder keyBuilder; private readonly IUserRepository repository; private readonly CacheManager cacheManager; public CachedUserRepository(IUserRepository repository) { this.repository = repository; keyBuilder = new CacheKeyBuilder(); cacheManager = CacheManager.Instance; } public IEnumerable<Content> GetWatchList(User user, Size cover = null, Pagination pagination = null) { var key = keyBuilder.Create(GetType()).With(user, cover, pagination).Build(); var entry = cacheManager.Get(key); if (entry != null) return (IEnumerable<Content>)entry; var result = repository.GetWatchList(user, cover, pagination); cacheManager.Add(user, key, result, Duration(CacheType.VeryLow)); return result; }
I'm caching the WatchList of the users. It's a web app and there could be several users, so I'm building a key for each one of them. That's fine. However, my repository has the following method as well:
public void AddBookmark(User user, Identifier contentId) { repository.AddBookmark(user, contentId); }
When the following method is called, I need to clear any cached data of the given user (method's parameter). How to accomplish that? ChangeMonitor is the way? And if it is, how can I write the code for it?
Take a look at WPF FlashMessage
About.me
Hi,
On Windows 8.1, using .net 3.5 SP1, sc.exe create command takes 2 minutes to install a service. On a Windows 7 system, the service installs immediately. Are there any thoughts on what might be happening on win 8.1 causing this delay.
A little background, I ran the sc command from Administrator command window. The machine is connected to domain and logged in with a domain user.
thanks!
Firstly I apologize about my poor English language.
please give me the solution to solve the problem related to the example link mentioned below.
what is the solution to give results in that program codes (in link) to give result even it difficult to match some constraints.
it gives result when all constraints match only. otherwise it do not display any result.
http://msdn.microsoft.com/en-us/library/ff628587%28v=vs.93%29.aspx
Thank you for your supporting
I am running into the dreaded Assembly.loadfrom file locking error. But only when our server is added to our test domain. If we remove it and put in just in a workgroup, we do not find this behavior.
Please help.?
class SampleClass
{
public int i = 10;
}
class MainClass
{
static void Main()
{
object a;
a = 1; // an example of boxing
Console.WriteLine(a);
Console.WriteLine(a.GetType());
Console.WriteLine(a.ToString());
a = new SampleClass();
SampleClass classRef;
classRef = (SampleClass)a; //Example of Unboxing
Console.WriteLine(classRef.i);
}
}
All classes in .net implicitly inherited from Object Class.In above code
classRef = (SampleClass)a; //Example of Unboxing is possible.
class BaseSample
{
public int ii = 10;
}
class SampleClass:BaseSample
{
public int i = 10;
}
class MainClass
{
static void Main()
{
SampleClass classRef;
BaseSample b = new BaseSample();
b.ii = 90;
classRef = (SampleClass)b; //Getting Run time Exception
}
Why I am gettting run time exception,
Boxing and UnBoxing is possible
public int ConvertToINT(object obj)
{
int i = (int)obj;
return Convert.ToInt32(obj);
}
public string CovertToString(object obj)
{
string s = (string)obj;
//return Convert.ToString(s);
return s;
}
Convert.ToInt32(obj); This is Base to derived and possible,
Butwhen
Base b=new Base();
Child c=(Child)b;//Gives run time exception
Why is it So.
Please help
Hi all,
I know this thread doesn't relate to any MS products but I really don't know other forum that can help me to resolve a development issue (I posted one on Dotspatial's codeplex forum but still no one reply, seehttps://dotspatial.codeplex.com/discussions/468994). Therefore I will repost this issue in .NET category because I also would like to know is there a .NET Sensor API for Windows 7 that can replace Dotspatial? I know there is a Location class in .NET but it only provide basic information such as latitude, longitude, altitude, HDOP, and VDOP, however our application also need to display extra information to user like number of fixed satellites, gps fixed status which can be handle by Dotspatial.
Here is the original post on Dotspatial forum:
"I ran DemoGPS on Windows 7 Pro Tablet PC that has a built-in ublox GPS device, but the app can't detect the device. I try
ublox's own software and GPS Utility and they can detect GPS device as well as receive Nmea data from gps.
Does DotSpatial support ublox devices? "
Hopefully someone can answer this :D!!
Thanks alot
Sam
Hi,
I am developing an application using mvc 5 in Visual Studio 2012. I have successfully build my model class.
My Model class:
using System;When i want to add a New Scaffolded item in controller , the following error occur:
Hi,
As per my findings Microsoft monitoring agent records only errors related information for a web application.Is there any way by which it can record all web requests, Responses and CPU Usage , Memory related information.
Looking forward for your reply.URGENTLY!!!!
Thanks
Hi Folks,
I am having a similar issue as mentioned Here in that a query for users name beginning with 'G' just brings back a set of random results (actually I get 10 records sorted into alphabetical order starting from 'A').
DirectorySearcher search = new DirectorySearcher(directoryEntry); search.SearchRoot = null; search.Asynchronous = false; search.Filter = String.Format("(objectClass=User)"); SortOption sortOption = new SortOption() { Direction = SortDirection.Ascending, PropertyName = "displayName" }; search.Sort = sortOption; DirectoryVirtualListView dvlv = new DirectoryVirtualListView(); dvlv.Target = searchCriteria.Trim(); dvlv.BeforeCount = 0; dvlv.AfterCount = 10; search.VirtualListView = dvlv; SearchResultCollection collection = search.FindAll()
Just wondering if anyone knows what the issue would be?
Also, while 'collection' will contain 10 results, if I then make a call to search.VirtualListView.ApproximateTotal; I get a COM exception as this property is not defined. If I breakpoint on the line, count 10 seconds and then check the value it will contain value (the entire number set of the users in A/D - rather than the 5 users I expect to get back).
This is indicating to me that the search is running asynchronously rather than blocking until it has a valid result set. Is there some way I can force it to wait until the search has completed so it does not throw an exception?
Regards
Andy