Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / July 2003

Tip: Looking for answers? Try searching our database.

Web Services and Forms Authentication Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chapman - 24 Jul 2003 10:35 GMT
Hello,

I'm a newbie in Web Services development.
At present, we have a web site implement in ASP.NET with
C#. We want to add some web service on the same site.

For security reason, we use Forms authentication mode and
deny user="?".

It gave System.Net.WebException to me if a web method was
invoked.

System.Net.WebException: The request failed with the error
message: -- <html><head><title>Object
moved</title></head><body> <h2>Object moved to <a
href='/login.aspx?ReturnUrl=%2fclientpage%2fclient1%
2fClientMenu.asmx'>here</a>.</h2> </body></html> --.

I have find some article on this issue, but it cannot this
problem. If I allow any users, it work fine.
This error occurred when deny user="?".

How can I solve this problem?
It seem quite difficult issue for me, and I look for a
helping-hand...

Many Thanks
Chapman
Vitaly Filimonov [MSFT] - 26 Jul 2003 01:19 GMT
Hello,

 Forms authentication that you are using on the web site was designed for
interactive applications since it requires someone entering user name
password in the dialog provided. Web service can't use this type of
authentication because it is normally called by the application, not a
person.

 Web services can use a variety of authentication other methods including
basic and Windows. Those things need to be set up in IIS (Web Server) and
your web.config will need to have the following setting:

   <authentication mode="Windows" />

 Next you will need to work on your client. Lets assume you will use Basic
Authentication (user name and password passed as clear text). In this case
you will need to supply user credentials in your call. This user must exist
in Windows user database of the Server (or domain) where your web service is
installed. Here is a little example assuming Service is the name of the web
reference:
---------
Service.Service1 svc = new Service.Service1();

ICredentials credentials = new NetworkCredential("user", "password",
"mydomain");
svc.Credentials = credentials;

Console.WriteLine(svc.HelloWorld());
Console.ReadLine();

---------

 This is not a very secure method though since you'd have to store and pass
a password in clear text. Much more sophisticated and secure solution would
be to use WSE (Web Services Extensions) from Microsoft which provides
security enhancements. You should use WSE if you are building a web service
accessible to public. WSE documentation and install can be found on
www.microsoft.com (current version is 1.0 SP1) - just type WSE in the search
box and it should display you search results including download options.

 Hope this helps a bit...

Signature

Vitaly.
-------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.

> Hello,
>
[quoted text clipped - 24 lines]
> Many Thanks
> Chapman

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.