Before you call for service;
svc.RequestSoapContext.Security.Tokens.Add(new UsernameToken(UserName, Password, PasswordOption.SendPlainText));
ASP.NET 4.0,C#,WCF,WF,MVC,Silverlight,Sharepoint
svc.RequestSoapContext.Security.Tokens.Add(new UsernameToken(UserName, Password, PasswordOption.SendPlainText));
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true" internalLogFile="c:\nlog.txt" internalLogLevel="Trace" >
protected override System.Net.WebRequest GetWebRequest(Uri uri) { string pass = "pass" + ":" + "****"; var key = Convert.ToBase64String(new System.Text.ASCIIEncoding().GetBytes(pass)); var basicKey= "Basic " + key; var getWebRequest = base.GetWebRequest(uri); getWebRequest.Headers.Add("authorization", basicKey); return getWebRequest; }
//Input Argument WF IDictionary<string, object> inputs = new Dictionary<string, object> { {"Person1", new Person{ Name="Tom", Age=26}} }; //Output Argument IDictionary<string,object> outputs=WorkflowInvoker.Invoke(new Activity1(),inputs); Console.WriteLine(outputs["Accepted"].ToString());
Open the Global.asax file then write code;
void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e) { if (e.Exception.GetBaseException() is FileNotFoundException || e.Exception.GetBaseException() is HttpException) e.Dismiss(); }
class Program { static void Main(string[] args) { try { throw new Exception("Expection"); } catch (Exception ex) { ex.SendErrorEmail(); } } } public static class MyExtension { public static void SendErrorEmail(this Exception ex) { //Write your send mail code //.... smtpClient.Send(mailMessage); } }