Hi everybody, I didn't know where to place this topic, so if mods consider that it should be elsewhere... no problem :). I'm developing a desktop application in C#. The first dialog it is a login form with user and password editboxes. I'd like to authenticate against a web service (using a database). Also, I'd like the connection was secure using SSL/TLS or whatever. I'm not sure how to do this, or if there is a better way to do remote authentication. I've been reading about WS-Security, SOAP... But before doing something, I wanted to ask here. Thank you. Regards
ika2
Posts
-
Web service authentication using desktop client -
New Bluetooth ProfileHi everyone, I'm developing an application that needs a new bluetooth profile, so I have to modify the Bluetooth stack to fit my requeriments. The stack should be something like this http://www.musenka.com/info/doc/MDP(MedicalDevicesProfile).pdf[^]. But I really don't know how to begin. I don't know if there is an open implementation of the BT stack that I can modify... Or if there is a way to use other stacks parts... I'm writing this in C# forum because my app is in C# but I suppose the stack changes and everything will be in C++. Any help would be appreciate :doh: Thanks in advance Kind regards
-
Blocking QueueWell, what I'm trying to do is a protocol stack implementation with layer abstraction. So, the communication between layers should be a product/manager scenario. I don't know if I'm right. So, I'm going to exchange my own objects in these queues. I suppose, the buffer shouldn't be fixed sized. I know it can be less eficient, but the size should grow when it's needed. The BlockingQueue implementation i have right now (I can't test it yet) is this:
public class BlockingQueue<T> : IEnumerable<T>
{
private int _count = 0;
private Queue<T> _queue = new Queue<T>();public T Dequeue() { lock (\_queue) { while (\_count <= 0) Monitor.Wait(\_queue); \_count--; return \_queue.Dequeue(); } } public void Enqueue(T data) { if (data == null) throw new ArgumentNullException("data"); lock (\_queue) { \_queue.Enqueue(data); \_count++; Monitor.Pulse(\_queue); } } IEnumerator<T> IEnumerable<T>.GetEnumerator() { while (true) yield return Dequeue(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<T>)this).GetEnumerator(); } }
Regards
-
Blocking QueueHi everybody, I need a multi-thread blocking queue to implement producer/consumer pattern in C#. I have found many BlockingQueue implementations around the internet. But I don't know which one is better. Which one do you recommend me? Regards
-
About Typed parametersThanks both. I think that your solution, Dave, could do the trick!!! Thankssss!! Kind regards
-
About Typed parametersHi everybody, I have this abstract method:
public static T DecodeData<T>(byte[] data, string encRules)
But the type T must be defined during runtime. I mean... I have other method like: GetDownloadType(id); Depend on the id, I should pass one or another parameter to DecodeData. But I dont know how.
public static Type GetDownloadType (int id) { switch (id) { case DOWNDIRECT: return typeof(DownDirect); case DOWNOTHER: return typeof(DownOther); case DOWNHEHE: return typeof(DownHehe); default: return null; } }
But when I try to use the Type result of this method to pass it to DecodeData... I cant. How should I do this? Thanks in advanced
-
Feature from Java... is in C#? [modified]Thanks to both. Nick, I have tried to do as you say, but I could't. Could you please paste a little example here? Thanks in advance
-
Feature from Java... is in C#? [modified]Hi everybody, I was looking a java code, and I would like to translate to C#, but I don't know if this feature exits in c#. The code is this:
public class Controller implements IController{
private State state; private Speed speed; private ProductHandler producthandler = new ProductHandler (){ @Override public void changeState(State newState) { state = newState; } @Override public Speed getSpeed() { return mds; } @Override public void send(Packet pk) { outputQueue.add(pk); } @Override public void setSpeed(Speed newSpeed) { speed = newSpeed; } };
ProductHandler is a class defined inside other class "dinamically". ProductHandler can access Controller attributes. Is this possible in C#? I have done it with events and so... but its very dirty. Is this annonymous classes, am i right? Is there something equivalent in .net 2.0? Regards
modified on Friday, January 8, 2010 2:50 PM
-
Web authentication by codeHi, I don't think they like this kind of access by code. With my tool, I could download many resumes in just a minute and this could stress their server. But thanks for the answer :) Regards
-
Web authentication by codeHi all, Until some months ago, I had a tool that could log into this web: http://www.infojobs.net/empresa_login.cfm[^] Using C# (desktop tool), i could login doing: NameValueCollection postdata = new NameValueCollection(); postdata.Add("e_email", name); postdata.Add("e_password", password); postdata.Add("tipoLogin", "1"); byte[] data = webClient.UploadValues(new Uri(_loginPage), postdata); After that, I saved the cookie and I could do other operations. Buf since 3-4 months, this code doesn't work. I think they have changed the authentication process, but i'm not able to identify the changes. With firebug I can see that the login form is the same. Does anybody know what have they modified? Thanks in advanced. PS: Sorry if this is not the place to post this thread. It's C# Code, but it's more a web problem.
-
Dynamic HTML to PDFHi, I've built an application that downloads with no problem a web. The next step is to convert it to PDF. To do this, there are some approaches: iTextSharp, a virtual printer, via command line... The problem is, that my HTML is a dynamic HTML, and when I preview the download web in my browser, it doesn't have style information, photos.. and so on. So, the future PDF will lack these too. All "src" and "href" tags are relative to the original url. How to modify the downloaded web to convert it properly to PDF? Thanks in advance. Regards
-
Post with webclient doesnt workHi all, I have a problem trying to log in this spanish web: http://www.infojobs.net. The login web is this: http://www.infojobs.net/candidato\_login.cfm For testing, I have created this user/pass: email/nick: testforlogin@hotmail.com pass: 1234 So, I've tried two ways: Option 1: string login = https://www.infojobs.net/candidato\_login\_run.cfm; NameValueCollection postdata=new NameValueCollection(); postdata.Add("email", "textBoxName.Text"); postdata.Add("password", textBoxPass.Text); byte[] data = clientWeb.UploadValues(new Uri(login), postdata); string page = Encoding.Default.GetString(data); Option 2: clientWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); string data = "email=" + textBoxName.Text + "&e_password=" + textBoxPass.Text; byte[] postArray = Encoding.ASCII.GetBytes(data); byte[] responseArray = clientWeb.UploadData(login, "POST", postArray); string paginaresultado = Encoding.Default.GetString(responseArray); Also, clientWeb is an extended WebClient class that manage cookies. And the login is always wrong :(. Any ideas? Thanks in advanced. Regards
-
Ldap AuthHi, I'm developing a tool to show several graphs. But only the users that have been succesfully authentificated by LDAP should see those graphs. I'm developing with MFC+Visual Studio 2003. I'm not really sure how to do this. I've been reading for a while about LDAP but I'm not sure how to implement authentification by LDAP in my App. This is just a test I have done doing copy&paste from other code, but it always returns err=0x31.
LDAP* ld = NULL; INT iRtn = 0; INT connectSuccess = 0; PCHAR pHost = NULL; PCHAR userDN = NULL; PCHAR pw = NULL; ULONG version = LDAP_VERSION3; // SecPkgContext_ConnectionInfo sslInfo; LONG lv = 0; CString strDomain; CString strName; CString strPass; // Verify that the user passed a hostname. GetDlgItem(IDC_DOMAIN)->GetWindowText(strDomain); GetDlgItem(IDC_PASSWORD)->GetWindowText(strPass); GetDlgItem(IDC_NAME)->GetWindowText(strName); CString dn = "CN=" + strName +",DM=" + strDomain; // Create an LDAP session. ld = ldap_open(pHost,0); if (ld == NULL) GetDlgItem(IDC_EDIT4)->SetWindowText("ldap_open failed"); else { GetDlgItem(IDC_EDIT4)->SetWindowText("ldap_open OK"); ld->ld_lberoptions = 0; pw = new char [strPass.GetLength()+1]; strcpy (pw,(LPCTSTR)strPass); userDN = new char [dn.GetLength()+1]; strcpy (userDN,(LPCTSTR)dn); INT err = ldap_simple_bind_s( ld, userDN, pw ); CString error; error.Format("%d", err); GetDlgItem(IDC_EDIT4)->SetWindowText("simple bind returned " + error); } if (ld != NULL) ldap_unbind_s(ld); if(pHost!=NULL) delete pHost; if(userDN != NULL) delete userDN; if(pw != NULL) delete pw;
Regards and sorry for my poor english -
Show sort header arrow and image in listview 2.0Of course, I´m using dllimport and I handled the ColumClick event. Win32 is only a class that hosts dllimports and other stuff. I know I can use ImageIndex to show the arrow. But... what I want is...to show an image and the arrow, at the same time. What I want is something like this: http://www.codeproject.com/cs/miscctrl/XPTable.asp. But with listview 2.0. kind regards and thanks for your answer
-
Show sort header arrow and image in listview 2.0Hi... In my application I have some listviews. I wanted to improve their appeareance adding an image to the headers. This is easy using smallimagelist of the listview class. The problem is that I want to show the sort arrow. For this I do it in this way:
IntPtr hHeader = Win32.SendMessage(this.Handle,Win32.LVM_GETHEADER,IntPtr.Zero,IntPtr.Zero); . . (more code) . . . Win32.SendMessage2(hHeader,Win32.HDM_SETITEM,new IntPtr(columnIndex),ref hd);
But when I click a header, the images dissapears. Does anybody know a solution for this issue? thanks -
Recomend me a profiler for 2.0The Subject says everything. Could you recommend me a good profiler (time and memory) for my programm written in C# 2.0??? thanks!! regards
-
Invoking GUIApplication.Run(new MyGUI()) should be enough
-
Pack references in an executable?thanks!!! is what I need! thanks again :) -- modified at 8:02 Friday 6th January, 2006
-
Pack references in an executable?hi... I have an exe compiled with VS and three references to 3 dlls within exe dir. Is there a way to pack this dll and exe to have only one exe?And if there is... is a safe way?is there any possibility that anyone identify those packed dlls? thanks regards
-
Place a form before show itdo it onLoad event and will work :)