Solved

how can i do windows form to prompt for password in C#.net windows application ??

Posted on 2011-03-07
4
713 Views
Last Modified: 2012-05-11
when i open abc.cs (windows form) then it prompt for Password , and if user give invalid password then it can not be login ....

how can i do this ??
0
Comment
Question by:Parth48
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Hairbrush
ID: 35055846
Hi

I am a bit confused.  You have a windows form, but you tagged your question as "ASP.NET" and you submitted it in the "Programming for ASP.NET" zone.  How does your Windows form interact with your ASP.NET web site?
0
 
LVL 18

Expert Comment

by:UnifiedIS
ID: 35057157
It would also be helpful to know how to determine if a password was legitimate or not.  Is this Windows authentication or a user account defined in a database or something else?
0
 

Author Comment

by:Parth48
ID: 35067759
No it's not windows authentication but user account defined in a database ....

how can i do this ??
0
 
LVL 12

Accepted Solution

by:
Hairbrush earned 500 total points
ID: 35068063
Parth98, you didn't answer my question, only the more recent one from UnifiedIS?

If you have a Windows application that is going to call say an ASP.NET web service then the normal approach would be to make a request to your web service method having set the credentials property of the HTTPWebRequest object to the credentials that the user entered, like this:

MyHTTPRequest.Credentials = New System.Net.NetworkCredential("myusername","mypassword");

The username and password will then be passed to ASP.NET in the header of the request.  If they are valid, then the web service method will run, and if not you will get an exception which you can handle by displaying a message to the user.

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.credentials.aspx
http://msdn.microsoft.com/en-us/library/system.net.networkcredential.aspx
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question