473,506 Members | 16,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restricting webservice..

Ann
Hi all,
My prj has a login form(Login.aspx).It uses Form authentication(Credential
stored in web.config).Once user is authenticated,it redirects to a
webservice(service.asmx)
that has a method that does some database operation.

this is the code..

if (FormsAuthentication.Authenticate(UsrNameTextBox.T ext, PwdTextBox.Text))
Response.Redirect("Service.asmx");
else
FormsAuthentication.RedirectToLoginPage();
My problem is,when the user types the asmx url directly in the
browser(localhost/service.asmx...) ,it should prompt for authentication and
if its not a valid user,i need to redirect him to login page

any suggestion,on how to do this???

Thnks
Sep 19 '06 #1
1 1361
Ann,

The way that ASP.NET handles authentication for web sites is completely
different from how authentication/authorization is handled on web services.
If anything, you should be using WSE (Web Services Enhancements) or Windows
Communications Foundation to handle your security needs.

Also, if these classes are in the same web app, then why are you
redirecting to the web service? Why not just call the class directly?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ann" <An*@discussions.microsoft.comwrote in message
news:FC**********************************@microsof t.com...
Hi all,
My prj has a login form(Login.aspx).It uses Form authentication(Credential
stored in web.config).Once user is authenticated,it redirects to a
webservice(service.asmx)
that has a method that does some database operation.

this is the code..

if (FormsAuthentication.Authenticate(UsrNameTextBox.T ext,
PwdTextBox.Text))
Response.Redirect("Service.asmx");
else
FormsAuthentication.RedirectToLoginPage();
My problem is,when the user types the asmx url directly in the
browser(localhost/service.asmx...) ,it should prompt for authentication
and
if its not a valid user,i need to redirect him to login page

any suggestion,on how to do this???

Thnks

Sep 19 '06 #2

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

Similar topics

8
425
by: DraguVaso | last post by:
Hi, I'm new to WebServices, and I'm doing some tests (with a small VB.NET-application) to know the performance-difference between a WebService and the 'normal'-way of getting data (just...
6
768
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a...
1
2096
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS)...
2
5682
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
7
2003
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
7
2899
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure...
5
3776
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains...
0
2664
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System;...
8
8693
by: sneddo | last post by:
Ok I am trying to do the above, I have got a script that will restrict the length but it requires the user to enter the field and hit a key, before it will work. This would normaly be find, but...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7370
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...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.