WCF / ASMX :: Access Session Variables Through A Web Service?
Mar 29, 2011
In my ASP.net website we are going to use Silverlight to display some interactive diagrams. The users can add, edit and delete various diagrams on the silverlight front end. Silverlight will call Web Service methods to save the changes into the database. Besides the data being passed by silverlight to web service call, we also need to pass some data from the session (like logged on user id etc.) to the web service call.
My question is that how silverlight can access session data? I am trying to pass session information via a webservice method call over to Silverlight but, the session variables inside the web service methods are returning null value.
The Web Service is running under the same web root where the ASP.net website using Silverlight is also hosted. I have made EnableSession = True for web properties.
I know I can allow the web service access to Session variables by adding (EnableSession=true). Is there a way to allow it access to global Application variables?
I have several resource intensive variables that are loaded in the Global.asax and I need access to there in the webservice.
I have an ASMX webservice hosted alongside my ASP.NET web app. Now, I need to get the users session into the Webservice. To test this I made this simple method:
[WebMethod(EnableSession = true)] public string checkSession() { return HttpContext.Current.Session["userid"].ToString(); }
So, first I login to my web app, then in the browser goto my webservice and click "checkSession" on that auto generated test page. I have tested this on 3 computers. All 3 of those work fine with the webapp(so the sessions are being created etc), and 2 of those return the value of Session["userid"] on invoking the webmethod, however the last computer returns "Object reference not set to an instance of an object" because Session is null.
So, whats the difference between these computers and why can my ASP.NET app get the sessions on all computers but the webservice cant?
I'm getting a strange data download from an Access database.Using Visual Web Developer 2010 Express, I created a web service that places records from an Access database in server cache and then reads the records, one at a time, from the cache. The data in the records is converted to a delimited string. The web service is called from an e-learning program called Toolbook that places Http Post calls to the web service. The web services uses vb and .Net Framework 2.0.
All works correctly with one exception. When a record in the Access db contains "&", it is downloaded to the Toolbook e-learning program as "&". If I place && in the record, I get "&&".If I download the data from the Access db using a classic.asp file rather than the web service, the "&" displays correctly.
I get this error when trying to access a self hosted wcf service...
[Code]....
Can someone explain what I need to do to get this to work, I do not have any cross domain policy file. And don't know how that is supposed to look like.
am new to webservice accessing from javascript.I call a webmethod from javascript which returns a string array. whith this array i bind a dropdown list at client.At dropdownList selectedIndexchanged event I found there is no item in DropDownList. Is there any way how to bind the DropDownList using webMethod so that on postback i can get the dropdowns item.
I have a web service which is accessible from the browser. When I try to access the same web service which is hosted on Windows Server 2008 R2, from an excel Macro, it says
Run-time error '-2147220991' (80040201)':
Server was unable to process request --> The request failed with HTTP status 404: Not Found.
The excel macro works fine when I try to access the same web service on the other server(Windows 2000 Server)
The web service is developed using .Net 2.0.
I'm posting the URL for the web service for your reference.
URLs which are not being accessible from Excel.
[URL]
[URL]
URLs which are being accessible from Excel.
[URL]
[URL]
Both Web services and Excel macros are old applications which have been running fine for years. The only change is that the application is being migrated to a new server(MCDEAGDWEB202) which has Windows Server 2008 R2 and SQL Server 2008.
The Old server(MCDEAGLWEB005B) has Windows Server 2000 and SQL Server 2000.
I have added a web service as a reference to a windows application using "AddWebRefrence" option. And I am unable to access the funtions in the web service but instead i get the functionnames followed by the completedeventargs and completedeventhandler.
What am I doing wrong and how can i access the funtions in the web service.
have two different applications. The only access between those two applications is Web Service.I want to delete records in the another application database by passing primary key of that table.I don't have access to database where I have to delete the records.For this, where I have to write the delete functionality.? In web service or or in my application.
this method i can access using asp.net but not by using a android.. i have checked for the headers etc.. the response is OK in android while debugging but the data is not inserted..
what is the equivalent of stringbuilder in android??
in android i use
StringEntity se = new StringEntity(json.toString());
//and post the data to my service...
post.setEntity(se);
what is the equivalent of stringentity in C# and what can i do for this prob?
I have created a dynamic web page . It gets loaded using a file keys.txt. This file holds the keys which are used to display a web page like panels order, text of labels , number of buttons and so on..It is consuming a web service written in delphi. All works fine but when 2 users try to access this service simultaneously then a error is displayed (Internal Server Error 500) "Access violation at address 0040404C in module "accelerate_gateway.dll". Read of address 00000000"Accelerate gateway is the name of delphi web service.It seems to me the problem of multi threading in delphi service ??But I have not done any multi threading in client asp.net page as well. ??It simply creates web service object and access its methods.As I am using a file contents to load a page, so I am concerned if it can create trouble as well ?? . Although I have used FileShare.ReadWrite in it.
I have a silverlight application that uses WCF service and i need to provide windows authentication using wcf.In order to achieve this i am trying to retrieve the client's credentials (windows credentials)inside wcf.
I have a module that subscribes to PreRequestHandlerExecute event, which uses the Session object. When i set the webconfig compilationdebug flag to false, the Session object is null when making requests to the web service. It works fine for .aspx requests, but only have problems for .asmx. When i set the debug flag to true everything works fine. I need to set this flag to false for production, but can't seem to get it work.I'm using II7 and the integrated pipeline, so this event will fire for all requests.
I am a newbie to ASP.NET (but not to C#)I have a project I am developing that may seem unconventional at this point but it is a project that I hope to eventually expand and provide a new type of service on the internet. Currently the project makes use of an Excel spreadsheet that is generated by another application I wrote. Basically the spreadsheet is an index to a specific type of file that exists on a host computer and the files are directly linked from within the excel document. When the link is clicked it opens the file using the operating system default program which then processes the file (this takes some time).
This is fine and dandy but when I click on another file, the default program immediately stops processing one file and opens the latest submission and thus interrupting the previous job. To prevent this I am now writing a queuing application. Here is where ASP.NET comes in. I do not want the link to open the queuing application with the file to add into the queue as a parameter because that pops one or more nnoying/scary "you are opening an executable" dialogs and because I want to be able to access the queuing service from a remote computer, and possibily in the future over the web. Instead I am trying to use an ASP.NET service application that will accept the name of a file as a parameter, access the external queue class (defined in an external dll of which only one universal instance is allowed), and add the request to the queue. Whether or not the table is an excel table or on a web page, using a form in this instance is tedious, not only for me but for a user. I want the user to be able to simply click on an html link and have the file be queued without anything except maybe a confirmation page pop up saying that the file has been queued and it will take x amount of time before the file is finished processing.
My problem is I cannot for the life of me find a way to do this. I have searched the interenet for over a week now looking for a way to call a "WebMethod" using a link and I am getting the impression that it cannot be done. Even when I use a form and try to have the form pass a string (representing the file name) as its "action" it comes up with an application error saying that I am missing the parameter I am trying to pass. Here are some examples of what I have tried:Here an example method I would try to access:
[Code]....
Here is an example of how I tried to access directly by way of a link (which results in an application error: InvalidOperationException)"
we have a situation where we need to host two certificates on the same server and because we can't have two different certificates on the same server running off the same port we have assigned one certificate run through another port, which is 4443.
So the URL to our web app is now....
[URL]
If I punch this into a web browser I can access it fine, however, if I create a web reference using this URL in Visual Studio (2005) it can create the web reference fine and it builds ok. But whenever I call a web method on this service instance I get a HTTP 404 page not found Exception.
Is there any properties I need to set on the web service object to get this to work? I'm confused as to why it's not working.
i am trying to collect 2 variables from one hyperlink, and use those variables in the page_load to set as session. but i don't know how to collect those 2 variables
i would like to collect '#FF0000','#FFE4E1' or direct set '#FF0000','#FFE4E1' to string then send to pageload, how can i do this by only clicking on it ?
I created a Class library for WCS service (MyWCFServiceLibrary) to access data form my database. The database connection strings have been defined in Properties->Settings.settings. The endpoints are defined in the app.config. Tracing and logging is set to write to files on local server. This service is hosted by a .net web service. This webservice refrences the WCF service using MyWCFServiceLibrary.dll and MyWCFServiceLibrary.pdb. The web service is hosted in IIS. All this setup is working fine on the development environment.Now I want to deploy this in the QA environment. Since I am a newbie with WCF, I would appreciate some help on what needs to be done for deploying this on the QA server.1. Do I need to recompile the MyWCFServiceLibrary.dll after changing the connectionstring to point to QA database and tracing and loggint paths to the new server?2. Is there anything that needs to be done with end points or anything else?
I am trying to access a wcf service hosted on a server running on a virtual machine on a windows 2008 R2 hyperv. When i access this service when running my asp.net website through code everything works fine how ever when i deploy the application on the local IIS , in the deployed mode i am getting an securityaccessdeined exception. My Asp.net app is running on a IIS server on another virtual machine. The stack trace is as given below :
Environment Info: My asp.net app has built on .NET 4.0 framework using VS2010. My WCF services are based on .NET2.0 framework. Event code: 3005
Event message: An unhandled exception has occurred.
I use some session variables to get the job done(shopping cart, etc) but it is not stable..manytimes I get no items in session object and other times(refreshing the page) I get missing data...I downloaded the entire site code to my local pc and debugged it and run it succesfully without any session data missing...When I run it in the server, I get bad session again: no products in shopping cart or products with missing quantities...
The same website runs smoothly in our production server too....The problem is with our development server...