Using OutgoingMessageProperties and OperationContextScope to implement authorization by http header for WCF client that communicates with non WCF-based web services.
This is another solution in addition to Solution 1.User ThreadPool as shown below.ThreadPool.QueueUserWorkItem(o => plugin.PluginSendClass.SendMessage(e));
In "REST - Overview" article, I were introduced the basic rules in RESTful, Can you show me how to implement in WebApi?Ok, in this article, we will learn how to implement those rules in WebApi using C#.Where could I get sourcode was used in this article?Please checkout the code at https://github.com
XmlNodeList to List without using a loop:var doc = new XmlDocument();doc.LoadXml("");var xmlNodeList = doc.ChildNodes;var nodees = new List(xmlNodeList.Cast());hope it helps
Because the width of a string is not the sum of the widths of all teh characters, except in non-proportional (or fixed width) fonts.In a fixed width font all characters are the same width, so the string is the width of a character times the number of characters:WIIIIILL12222234But in a...
Hi, well the easiest way that comes to my mind is to do it with a LINQ like this:int[] nonMatching = n.Except(m).Union(m.Except(n)).ToArray();In short the n.Except(m) returns n array's items that are not found in m array, m.Except(n) does the vice versa and the Union will combine those two...
Please see my comment to the question. You need to specify your application type or UI library you want to use. If you don't have preference, you should tell us about it, as "what would you advise".Now, very clear tutorial is — on what topic? Don't expect and look for tutorials on...
First of, never fetch DateTime.Now more than once: it leads to intermittent problem around midnight which can really mess you up. Fetch it once, and use it for all checks.Then try:DateTime now = DateTime.Now;var receiveDetails = objDB.GetAllReceivedDetails().Where(a =>...
well I would do it like this:string s = "racecar";bool b = s == s.Reverse().ToString();but as you said not to use reverse:string s = "racecar";for (int j = 0; j
I made a little changes in your code and its working fine MailMessage message = new MailMessage(); message.To.Add("ashish_tyagi_20@yahoo.co.in"); message.From = new MailAddress("username@gmail.com"); message.Subject = "New test mail"; ...
Set up a Timer in the form. Set it's interval to a shortish period: say thirty seconds.Set up a DateTime. Whenever there is "activity" (however you define that) reset the DateTime to DateTime.Now.AddMinutes(30).In the Timer Tick Event check the current time against the timeout...
Use a Regex:(?)[^\/// Regular expression built for C# on: Sun, Oct 9, 2011, 07:37:07 AM/// Using Expresso Version: 3.0.3634, http://www.ultrapico.com////// A description of the regular expression:////// ...
That's far too obscure.All you need to do is store a reference to the TabPage instance which was removed from the TabPages collection of the TabControl. You may use the form where the TabControl is placed for that purpose.You could also create your own TabControl which has an extra property...
Yes, there is a better way: write new application from scratch, using just the ideas from old application. The more you try to "reuse" the UI code, the more time you will waste — this observation was done on several projects.Of course, if you managed to separate non-UI code from UI...
Please see this CodeProject article Graphical BinaryTrees[^]In this article it is written that "This article is about binary trees. A Binary Tree contains unlimited number of nodes, the nodes can be removed, added, searched, etc. Here we will discuss on how to make a binary tree on c# code,...
The solution is simple: stop abusing PictireBox. This simple control class which could help you in simplest cases, not helping you here, only creates unwanted intermediate layer to eat up extra resources and waste extra development time giving nothing in return, compared to using a custom...
The question is not silly at all; it is pretty deep and not trivial.Very basically: the ability to It does know that because an executable image in the .NET assembly carries...
This article will show how to create and/or a list of a particular class type from a SqlDataReader object by dynamically creating a lambda expression to carry out the process of populating the list.
OK, first and foremost, Microsoft does not support and actively discourages using Office Interop in non-user applications, i.e.: Services and web applications.Office was not written to support a non-interactive environment. You can have problems using Office Interop in your...
This is really easy - but it's hard to work out for the first time. For example, get a list of files, and group them by the date which is in the 2nd to 10th characters of the name, ignoring extensions. Easy!
You can create Excel file dynamically from GridView and save it on the hard disk. Perhaps your clients have enough GridView's functionality? This is not quite accurate solution to your problem, but may also help to solve it:using System;using System.Data;using...
// Get all drives on system and loop through themSystem.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();foreach (System.IO.DriveInfo drive in drives){ // Is this a CD drive? if (drive.DriveType == System.IO.DriveType.CDRom) Console.WriteLine(drive.Name);}
Form1 form1= new Form1();form1.Close();Form1 is the form class which you want to close if you want to close another form from current form. this.Close();If you want to close current form.Application.Exit();To close application.
Please, forget about your 64 (OMG!) pictureboxes and draw the board yourself. Check out this[^] excellent CodeProject article for details on drawing the board and for the chess game implementation at all! [UPDATE - After the comment from OP]Well, it didn't changed anything for me....
Your problem is probably because you are using the Image.FromFile() method. There is a known problem with this method, in that it locks the file.Use the Image.FromStream()[^] method instead and all should be well.
First of all, I don't think System.Random gives predictable results. If you say so, would you please demonstrate your prediction? However, I'm not sure if the result of random generation is not correlated and obey required distribution. Even if it not perfect, it does not mean...
I am not sure whats the issue in implementation. Keep a timer control on the form and configure it for a given period. If user is not interacting for that given period then close the form/application.If you want to open a screensaver or a new form, based on the time lapsed in the timer, you...
SHA will not "encrypt/decrypt a file".It is not an encryption algorithm.It is a Hashing algorithm.If you generate a SHA from a file, you cannot get the file back from the SHA value. At all. Ever. Period.Did you really think that a 5Mb file could be "encrypted" into 128 bits, and...
I guess you'll need to set up a Windows CE development environment as you describe - It's likely that the device supports the OPOS (COM base) /NPOS (.Net based) APIs.I suggest you head over to the Symbol Site[^], they usually provide the required info, but you have to dig around a bit...
Having worked with Symbol devices the packaging comes as a shock the first time, as you only get the device.You have two options for these devices programming wise :1) Visual C++ 2) .net Compact FrameworkI would recommend .net programming as it is much easier. Symbol has very good...
You will probably want to respond the to the DataGridView.SelectionChanged Event[^].In its handler check if a single row has been selected then get the values from that row and place them in the text boxes.private void DataGridView1_SelectionChanged(object sender, EventArgs e){ if(...
"dose it mean that the file became an encrypted file?"No. It means it becomes a corrupted file.Encryption is a name for a specific process: transforming information so that it cannot be understood without reversing the process using the key value that was used to transform it. Just messing...
You certainly can store the code in database, but running it will be way more difficult. To run code dynamically, you need to compile it, which is quite possible through CodeDOM. It actually works through regular C# compiler, and this compiler is always bundled with all versions of .NET and run...
Using the @@identity column will help you out.Tryhttp://msdn.microsoft.com/en-us/library/aa933196%28v=sql.80%29.aspx[^]http://msdn.microsoft.com/en-us/library/ms187342.aspx[^]
Use the OUTPUT Clause[^] - you'll find examples on how to use this at the bottom of the page.Input and Output Parameters, and Return Values[^] shows you how to access the output from .Net[Update]If you follow this approach you don not need to implement stored procedures to get the job...
You are almost there.The problem is that everytime the timer ticks you update the slider value, which causes your slider value changed handler to fire, which sets the position on the video, causing it to skip.Use a variable to suppress the code in the slider value changed handler before...
Long running tasks are done using threads, not timers. The only one little problem with having some extra thread performing such a long running task under the UI is that you cannot directly operate UI from that thread. This problem is solved using UI thread invocation mechanism.You cannot...
Please, read all comments to your question. As i mentioned: 'if it works for you, then do nothing', but... Sergey Alexandrovich Kryukov is right: it depends on many factors...I'd suggest to read this: LINQ to SQL vs Entity framework [ Which one is better with .net 4.0][^] to find out major...
you can do it with Linq GridView1.DataSource = dtExcelRecords.AsEnumerable().Skip(6).CopyToDataTable();Ref:http://msdn.microsoft.com/en-us/library/bb396189(v=vs.90).aspx[^]
You did not add this button to anything in your UI. The missing piece is something likebtn.Parent = someParentControl; // such as Panel or Form// same as:sameParentControl.Controls.Add(btn);—SA
You can't calculate strings. You need to convert it to numbers.Try Int32.TryParse[^] method.Example: String sNumber = "123,456,789"; int iDenominator = 12; NumberStyles numStyle = NumberStyles.AllowThousands ; CultureInfo culture = new...
Hi,let's have a look at an example Windows Forms application.Form1.csusing System;using System.Windows.Forms;namespace WindowsFormsApplication2{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } ...
If you have any DateTime property in Movie class please initialize with current DateTime like below before save movieToCreate.DateProperty=DateTime.Now;_db.AddToMovies(movieToCreate);_db.SaveChanges();Hope this helps
This is not an anonymous type; this is just a type obtained from type inference. Considervar stringBuilder = new System.Text.StringBuilder();string whatIsIt = stringBuilder.GetType().FullName;The last line will return "System.Text.StringBuilder", quite fully named :-); and the first line...
That's not really a good idea.But essentially you can reuse your code behind in most parts and will have to rewrite the UI. If you seperated logics from presentation you should already have a business layer and the change is not that difficult.If you didn't and have a so-called fat...
No, the system belongs to the user, not the application. This is just the sort of question that spammers and hackers are always asking. And no one here is going to help you to become one of those annoying types.
This is due to operator precedence. Your code is equivalent to:if (("Call Time: " + searchResult[i].CreatedDate) != null){ sb.Append(Convert.ToDateTime(searchResult[i].CreatedDate).ToString("hh:mm tt"));}else{ sb.Append("" + "");}Since anything...
If the user spends 2 seconds per row it would take them 27 hours to look at your gridview. Returning that amount of data is a very bad idea for many, many reasons, some of which you are finding out now. Use paging or implement some sort of filtering\search. Why present data that is useless?
As you are trying to start completely from scratch, probably the best way is to observe how the .NET Button class was written in the first place.The source code for that can be looked on the .NET Reference Source[^] site.Give it a go and if you hit problems come back with a specific question
When you copy a file into another directory, you also have to specify a file name; right now you are copying to %AppData%\Master, but you have to copy to %AppData%\Master\FileNameHere.exe. Use this File.Copy call to copy the executable correctly:File.Copy(src, Path.Combine(dest,...
If your DELL PC doesn't have the required permissions, then the only way they are going to be able to view the files is get up, walk to the RACKSPACE PC and look at it's screen using it's keyboard and mouse...That's what permissions are there for: to prevent people who aren't authorised...
That code is exception handling, but pretty pointless handling. If all you are doing is re-throwing the exception then don't bother with the try\catch block. If you are going to rethrow then use just "throw" and not "throw ex" and you lose some exception context with you throw a new exception...
A regular expression seems to be what you need here:using System.Text.RegularExpressions;Regex regex = new Regex(@"^(?[0-9]+)(?[^0-9]+)$", RegexOptions.Compiled | RegexOptions.CultureInvariant);string input = "12pcs";Match m = regex.Match(input);int quantity =...
Hello ,As per your requirement try this below codeDateTime date= DateTime.Now; string format = "ddMMyyyhhmmsstt"; Console.WriteLine(date.ToString(format)); and O/P will be15122015063146AM
txtPrice.Text is a stringproduct.Price is an intSo yes, you have to convert the text to an integer before you assign it to the Price propertyI suggest using int.TryParse() to do the conversion - see How to: Convert a String to a Number (C# Programming Guide)[^]
Using MVC, Entity Framework, ASP.NET5 Scaffolding, and Azure SQLServer you can create a web application that stores your information on an SQL Azure database. This demo shows you how to create a web application with MVC and Entity Framework 7, that communicate with a SQL Azure Database
The problem is that you are using string concatenation to build your queries. That leaves your code vulnerable to SQL Injection[^].You need to change your code to use parameterized queries instead. That means switching from the mysql_ methods to either MySQLi[^] or PDO[^].This SO...