• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 746
  • Last Modified:

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

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
Parth48
Asked:
Parth48
  • 2
1 Solution
 
HairbrushCommented:
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
 
UnifiedISCommented:
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
 
Parth48Author Commented:
No it's not windows authentication but user account defined in a database ....

how can i do this ??
0
 
HairbrushCommented:
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

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now