473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Login to the WebService

Hi all,

have problem to use login to the web service. Im thinking about the web
service that provides datas and files to the WinForm Client. I want the
client log-in to the application... here is my not-working solution

this is my web service, with the Forms authentication and working on
AspSqlMembershipProvider and with Role provider implemented too. It is
working well. I can create user, I can ValidateUser... But I would like,
that I once ValidateUser, then it will be validated and authenticated whole
time the Client application is opened. So I will able to call
TrySecured() Method. What is the best practice, to do it?

In a few points:

1. Client App is a WinForm client
2. Must provide Creating new user -AspSqlMembershipProvider
3. Must provide only once SignUp to the aplication over web service via
AspSqlMembershipProvider
4. Some methods will be available only for authenticated users, or access to
the methods will be managed via Membership roles.

public class UserAccountService : System.Web.Services.WebService
{

[WebMethod]
public bool Login(string userName, string password)
{
bool retVal = Membership.ValidateUser(userName, password);
return retVal;
}
[WebMethod]
public string GetCurrentUser()
{
MembershipUser mUser = Membership.GetUser();
return mUser.UserName;

}
[WebMethod]
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
public string TrySecured()
{
return "Secured call successful";
}
}

Thanks a lot for any ideas.
Mike

Oct 31 '08 #1
2 2252
Hi Mike,

From your description, I understand you're encountering some problem get
authentication to seup for an ASP.NET webservice application, correct?

Based on the current settings and code snippet you mentioned, it seems
you're trying to use FormsAuthentication and Membership Provider to perform
user validation. As for forms authentication, I'd like to confirm the
following things:

1. Forms authentication depend on cookies to maintain authentication
cookie, therefore, if you use formsauthentication, you'll make your
webservice coupled to ASP.NET web environment and require the client-side
to support cookie. This is not recommended for standard webservice. Here is
a web article which mentioned Forms Authentication and implement all the
cookie related authentication ourselves:

#Authentication in ASP.NET Web Services
http://progtutorials.tripod.com/Authen.htm

Also, for ASP.NET webservice, there are many different kind of
authentication approach avaliable, the most common is windows
authentication(utilize the IIS webserver). And for custom authentication,
you can consider using "SoapHeader" to carry authentication properties:

#Authenticate .NET web service with custom SOAP Header
http://www.codeproject.com/KB/webser...ntication.aspx

#User Authentication in ASP.net Web Services
http://www.microsoft.com.nsatc.net/c...s/default.aspx
?dg=microsoft.public.dotnet.framework.aspnet.webse rvices&tid=0d3a95ad-7405-4
bfe-ade9-be80af42abee&cat=&lang=&cr=&sloc=&p=1

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we

can improve the support we provide to you. Please feel free to let my
manager know what you think of

the level of service provided. You can send feedback directly to my manager
at: ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from

the community or a Microsoft Support Engineer within 2 business day is
acceptable. Please note that

each follow up response may take approximately 2 business days as the
support professional working

with you may need further investigation to reach the most efficient
resolution. The offering is not

appropriate for situations that require urgent, real-time or phone-based
interactions. Issues of this

nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft

Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Mike Endys" <Mi******@nospam.nospam>
Subject: Login to the WebService
Date: Fri, 31 Oct 2008 11:53:57 +0100

Hi all,

have problem to use login to the web service. Im thinking about the web
service that provides datas and files to the WinForm Client. I want the
client log-in to the application... here is my not-working solution

this is my web service, with the Forms authentication and working on
AspSqlMembershipProvider and with Role provider implemented too. It is
working well. I can create user, I can ValidateUser... But I would like,
that I once ValidateUser, then it will be validated and authenticated whole
time the Client application is opened. So I will able to call
TrySecured() Method. What is the best practice, to do it?

In a few points:

1. Client App is a WinForm client
2. Must provide Creating new user -AspSqlMembershipProvider
3. Must provide only once SignUp to the aplication over web service via
AspSqlMembershipProvider
4. Some methods will be available only for authenticated users, or access
to
the methods will be managed via Membership roles.

public class UserAccountService : System.Web.Services.WebService
{

[WebMethod]
public bool Login(string userName, string password)
{
bool retVal = Membership.ValidateUser(userName, password);
return retVal;
}
[WebMethod]
public string GetCurrentUser()
{
MembershipUser mUser = Membership.GetUser();
return mUser.UserName;

}
[WebMethod]
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
public string TrySecured()
{
return "Secured call successful";
}
}

Thanks a lot for any ideas.
Mike
Nov 3 '08 #2
Hi Mike,

How are you doing?

Have you got any further id ea on this issue or does the information in my
last reply help you some?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we

can improve the support we provide to you. Please feel free to let my
manager know what you think of

the level of service provided. You can send feedback directly to my manager
at: ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/en-us/subs...#notifications.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

From: st*****@online.microsoft.com ("Steven Cheng")
Organization: Microsoft
Date: Mon, 03 Nov 2008 04:14:30 GMT
Subject: RE: Login to the WebService
Hi Mike,

From your description, I understand you're encountering some problem get
authentication to seup for an ASP.NET webservice application, correct?

Based on the current settings and code snippet you mentioned, it seems
you're trying to use FormsAuthentication and Membership Provider to perform
user validation. As for forms authentication, I'd like to confirm the
following things:

1. Forms authentication depend on cookies to maintain authentication
cookie, therefore, if you use formsauthentication, you'll make your
webservice coupled to ASP.NET web environment and require the client-side
to support cookie. This is not recommended for standard webservice. Here is
a web article which mentioned Forms Authentication and implement all the
cookie related authentication ourselves:

#Authentication in ASP.NET Web Services
http://progtutorials.tripod.com/Authen.htm

Also, for ASP.NET webservice, there are many different kind of
authentication approach avaliable, the most common is windows
authentication(utilize the IIS webserver). And for custom authentication,
you can consider using "SoapHeader" to carry authentication properties:

#Authenticate .NET web service with custom SOAP Header
http://www.codeproject.com/KB/webser...ntication.aspx

#User Authentication in ASP.net Web Services
http://www.microsoft.com.nsatc.net/c...s/default.aspx
?dg=microsoft.public.dotnet.framework.aspnet.webse rvices&tid=0d3a95ad-7405-4
bfe-ade9-be80af42abee&cat=&lang=&cr=&sloc=&p=1

Hope this helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Mike Endys" <Mi******@nospam.nospam>
Subject: Login to the WebService
Date: Fri, 31 Oct 2008 11:53:57 +0100

Hi all,

have problem to use login to the web service. Im thinking about the web
service that provides datas and files to the WinForm Client. I want the
client log-in to the application... here is my not-working solution

this is my web service, with the Forms authentication and working on
AspSqlMembershipProvider and with Role provider implemented too. It is
working well. I can create user, I can ValidateUser... But I would like,
that I once ValidateUser, then it will be validated and authenticated whole
time the Client application is opened. So I will able to call
TrySecured() Method. What is the best practice, to do it?

In a few points:

1. Client App is a WinForm client
2. Must provide Creating new user -AspSqlMembershipProvider
3. Must provide only once SignUp to the aplication over web service via
AspSqlMembershipProvider
4. Some methods will be available only for authenticated users, or access
to
the methods will be managed via Membership roles.

public class UserAccountService : System.Web.Services.WebService
{

[WebMethod]
public bool Login(string userName, string password)
{
bool retVal = Membership.ValidateUser(userName, password);
return retVal;
}
[WebMethod]
public string GetCurrentUser()
{
MembershipUser mUser = Membership.GetUser();
return mUser.UserName;

}
[WebMethod]
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
public string TrySecured()
{
return "Secured call successful";
}
}

Thanks a lot for any ideas.
Mike


Nov 5 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Linda Chen | last post by:
Hello, I made a webservice, the user is asked to login to the server before making other calls. I have problem to keep the login state. Inside my web service I have a private boolean called...
1
by: Matthias | last post by:
Hi guys, I have a web service which is protected by WSE with a usernametoken. The user is calling the web-service and the web-service should automatically login the user to the site with the web...
5
by: Matthew.DelVecchio | last post by:
hello, i am working w/ a partner company's webservice, which they wrote in java. using a provided webservice.wsdl file, i am able to compile it into a proxy class, webservice.dll. i can add...
6
by: clusardi2k | last post by:
Hello again, I have to go home and read up on Access. But, I have read else-where in this newsgroup that I can just save the password in the database under scrutiny. Wouldn't it be wasteful...
1
by: kSrilluVaishu | last post by:
hi I am getting this error when i am accessing my application site from a browser but not when executing my application.I am using webservice to get data from the data base.I am using login controls...
3
by: chris fellows | last post by:
I am writing a generic login mechanism for our web apps using ASP.NET / C# (VS2005). Various web pages need to present a login dialogue for the user to re-enter their application-level username &...
0
by: bharadwajrv | last post by:
i'm writing a clinet application in C# (VS 2003) to consume a webservice which takes login name and password in the soap-header.. Can you advice me how shoudl i be sending these infromation, as i...
0
by: gh | last post by:
I am using VS 2008 and C#. I have a php website on another server that will be accessing my asp.net site. What the user will do is type in a password\login at the php site. I will need to get...
1
by: Hiran | last post by:
I have a simple 'hello world' web service here http://www.askhiran2008.com/asliwebservicevb2/service.asmx. It should return data from the Northwind sample database. It works fine when being...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.