Click here to Skip to main content
15,910,661 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error creatin window handle Pin
eoe19-Sep-07 19:20
eoe19-Sep-07 19:20 
AnswerRe: Error creatin window handle Pin
mav.northwind19-Sep-07 19:17
mav.northwind19-Sep-07 19:17 
GeneralRe: Error creatin window handle Pin
eoe19-Sep-07 21:24
eoe19-Sep-07 21:24 
GeneralRe: Error creatin window handle Pin
Judah Gabriel Himango20-Sep-07 4:26
sponsorJudah Gabriel Himango20-Sep-07 4:26 
QuestionFire a keyboard event.... Pin
Arish rivlin19-Sep-07 3:56
Arish rivlin19-Sep-07 3:56 
AnswerRe: Fire a keyboard event.... Pin
Judah Gabriel Himango19-Sep-07 4:35
sponsorJudah Gabriel Himango19-Sep-07 4:35 
GeneralRe: Fire a keyboard event.... Pin
Arish rivlin19-Sep-07 6:10
Arish rivlin19-Sep-07 6:10 
QuestionWhy does my Service with Custom UserNamePasswordValidator not run?? Pin
jogibear998819-Sep-07 3:20
jogibear998819-Sep-07 3:20 
I've realized a custom UserNamePasswordValidator.

And I can't run my Service anymore.

if I remove the line :
tcpBinding.Security.Mode = SecurityMode.Message;

it works again, but without user validation....


here the source:


class Program
{
static void Main(string[] args)
{
ServiceHost myHost = new ServiceHost(typeof(classServerFunktionen));


NetTcpBinding tcpBinding = new NetTcpBinding();
tcpBinding.TransactionFlow = false;
tcpBinding.Security.Mode = SecurityMode.Message;
tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;


myHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = System.ServiceModel.Security.UserNamePasswordValidationMode.Custom;
myHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CustomUserNameValidator();

myHost.AddServiceEndpoint(typeof(IServerFunktionen), tcpBinding, "net.tcp://localhost:8777/MyProdService");

//Server starten
myHost.Open();




Console.WriteLine("The service is ready.");
Console.WriteLine("Press <enter> to terminate service.");
Console.ReadLine();
//Server schließen
myHost.Close();

}


}

public class CustomUserNameValidator : System.IdentityModel.Selectors.UserNamePasswordValidator
{
public override void Validate(string userName, string password)
{
if (null == userName || null == password)
{
throw new ArgumentNullException();
}

if (!(userName == "test1" && password == "1tset") && !(userName == "test2" && password == "2tset"))
{
throw new System.IdentityModel.Tokens.SecurityTokenException("Unknown Username or Incorrect Password");
}
}
}

//Implementierung des Interfaces mit den Serverfunktionen...
public class classServerFunktionen : IServerFunktionen
{
public String rights;

public String getMessage()
{

return "Hallo Session:" + OperationContext.Current.SessionId;

}

public String getMessage2()
{
return "Hallo2 Session:" + OperationContext.Current.SessionId;
}
}

and my interface:

[ServiceContract]
public interface IServerFunktionen
{
[OperationContract] //(ProtectionLevel = ProtectionLevel.EncryptAndSign)
String getMessage();
[OperationContract]
String getMessage2();
}
AnswerChannelDispatcher error Pin
jogibear998819-Sep-07 8:45
jogibear998819-Sep-07 8:45 
QuestionHow to Dynamically populate Checkbox in Gridview asp.net 2.0 Pin
SJSaranya19-Sep-07 3:13
SJSaranya19-Sep-07 3:13 
AnswerRe: How to Dynamically populate Checkbox in Gridview asp.net 2.0 Pin
fearless stallion19-Sep-07 16:45
fearless stallion19-Sep-07 16:45 
QuestionMax size of String in body of email using Process.Start( String.Format("mailto:{0}?Subject={1}&Body={2}" Pin
lovelylooney19-Sep-07 3:07
lovelylooney19-Sep-07 3:07 
AnswerRe: Max size of String in body of email using Process.Start( String.Format("mailto:{0}?Subject={1}&Body={2}" Pin
Pete O'Hanlon19-Sep-07 3:25
mvePete O'Hanlon19-Sep-07 3:25 
QuestionEnding another process Pin
__DanC__19-Sep-07 2:55
__DanC__19-Sep-07 2:55 
AnswerRe: Ending another process Pin
Pete O'Hanlon19-Sep-07 3:04
mvePete O'Hanlon19-Sep-07 3:04 
GeneralRe: Ending another process Pin
__DanC__19-Sep-07 3:06
__DanC__19-Sep-07 3:06 
AnswerRe: Ending another process Pin
Luc Pattyn19-Sep-07 6:00
sitebuilderLuc Pattyn19-Sep-07 6:00 
GeneralRe: Ending another process Pin
__DanC__19-Sep-07 6:02
__DanC__19-Sep-07 6:02 
GeneralRe: Ending another process Pin
Pete O'Hanlon19-Sep-07 9:58
mvePete O'Hanlon19-Sep-07 9:58 
GeneralRe: Ending another process Pin
martin_hughes19-Sep-07 12:43
martin_hughes19-Sep-07 12:43 
GeneralRe: Ending another process Pin
Pete O'Hanlon19-Sep-07 21:49
mvePete O'Hanlon19-Sep-07 21:49 
Questionpass progressBar control to function in a different class and thread Pin
gizmokaka19-Sep-07 2:46
gizmokaka19-Sep-07 2:46 
AnswerRe: pass progressBar control to function in a different class and thread Pin
gizmokaka19-Sep-07 4:04
gizmokaka19-Sep-07 4:04 
Questionhow to display a msg on leaving a page Pin
samerh19-Sep-07 2:29
samerh19-Sep-07 2:29 
AnswerRe: how to display a msg on leaving a page Pin
Guffa19-Sep-07 3:00
Guffa19-Sep-07 3:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.