Click here to Skip to main content
15,887,416 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello Again,

I am using a service Service1.svc in an asp.net web application.
My concern is how can I session username from login.aspx.cs to this .svc file and at the same time I also want to session the page name(login.aspx.cs) to service file.

I have tried following to session username:
C#
string uname=HttpContext.Current.Session["user"].ToString();

But it says object is not created.

And as a doubt, how many services can I have in a single web application?

How can I achieve this?

Any help or hint will do. :-)

What I have tried:

I have tried following to session username:
C#
string uname=HttpContext.Current.Session["user"].ToString();

But it says object is not created.
Posted
Updated 20-May-16 5:13am
v3

1 solution

First of all, IMHO it is not a good idea to use ASP.NET hosted WCF services, but you better choose ASMX...
However if you choose to stick with WCF and you want it cooperate with ASP.NET, you have to take care a few things:
1. Use HTTP binding (too)
2. Adjust ASP.NET compatibility of the WCF service
The details are here:
WCF Services and ASP.NET[^]
Hosting WCF Services in ASP.NET – The Survival Guide | leastprivilege.com[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900