.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

RequestSoapContext.Current is always null

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :Sql Server

Hi, All,

I developed a customized delivery extension (SSRS) and deployed it in GAC (global assembly cache) on our report server. I also modified 4 config files (RSReportServer.config, RSWebApplicaiton.config etc) to make the extension work (thanks for Jin’s help).

Now when I tried to use this customized delivery extension to schedule a report, I got an error which caused by RequestSoapContext.Current is always null. The version of Microsoft.Web.Services2.dll is in RSReportServer.config which is the same with the version in GAC. And we have .NET SDK (2.0) and WSE 2.0/3.0 installed on the report server. What could be the cause and how to fix it?



View Complete Post

More Related Resource Links

Users getting logged out because HttpContext.Current is null


We've  been trying to fix this one for a couple years, and I'm just out of ideas, so any help is really appreciated!

We've got a fairly large, complex web application that uses Forms Authentication to authenticate users.  Throughout the application we store and retrieve information about users in the Session object, and in some cases in cookies.  In a couple places we check for the existence of the context, and if it's null we send the user back to the login page to re-establish the session. 

Just a quick run-down of this web app: C#, .NET 3.5, IIS 6, ASP.NET State Service to manage session

As for the session timer, we use our own home-grown timer, which is basically a client-side timer, which is backed up by a check to the SQL database to see when their last activity was.  This seems to work well for us.  It's not perfect, but it allows us to notify the user before the session times out, and allows us to be certain we're not logging a user out before their 60 minutes of inactivity is up.

What's happening is that certain users are being logged out after just a few minutes.  We've eliminated the timer as a cause and believe what's happening is the HttpContext.Current is null, so the user is logged out.  We do not know why the HttpContext.Current is null, and I underst

HttpContext.Current is null

I have an intermittent issue where HttpContext.Current is null.  I do have aspNetCompatibilityEnabled="True".  I can duplicate it by restarting the webservice and make the request.  The first request has the HttpContext.Current set to null but subsequent requests have the proper HttpContext.  I've done some tracing and the messages are exactly the same. What else is weird is that the HttpContext is NOT null in my global.asax but by the time it hits my custom UsernamePasswordValidator, it is set to null.   Any ideas on what i'm doing wrong? HttpRequest from tracing: <HttpRequest> <Method>POST</Method> <QueryString></QueryString> <WebHeaders> <Cache-Control>no-cache</Cache-Control> <Connection>Keep-Alive</Connection> <Content-Length>799</Content-Length> <Content-Type>text/xml; charset=utf-8</Content-Type> <Accept>*/*</Accept> <Accept-Encoding>identity</Accept-Encoding> <Host>mydomain.com</Host> <User-Agent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.2)</User-Agent> <SOAPAction>"http://tempuri.org/ICategoryService/GetAvailablePickList"</SOAPAction> </WebHeaders> </Htt

HTTPContext.Current.Session is NULL in SharePoint 2007 (MOSS)


For some strange reason HTTPContext.Current.Session is null in SharePoint 2007 web application.

Session is enabled everywhere and used to work so its not a setup issue. Something got corrupted at some point either via patches or something...

Doing "Reset To Definition" fixes the issue, but I can't do that in production environment and what is reset to definition has to do with session being null?

Searching on the web found a post from someone having same exact issue:


I need to know how to FIX this w/o doing complete "Reset To Definition".

SPContext.Current is null in a WebService in the 12 hive layouts



  I do not understand why I cannot get the SPContext.Current instance.  It must be an IIS Setting because I get it on one machine and not on another, using identical code.

SPContext.Current is null In Custom Membership ValidateUser


Hi,I just get a problem getting SPContext.Current in Custom membership Provider.

We have successfully plugin the custom membership into Sharepoint foundation 2010. We tried to programmically update the user's full name after user logs in and it failed in 2010 version. (good in 2007)

This is the simplified code. The class is a custom membership provider.Strangely, this only happens in 2010 version and never raised a problem in 2007.

public override bool ValidateUser(string username, string password)
   bool isvalid = false;

    if(username=="admin" && password="pwd")
      isvalid = true;
     var webContext = SPContext.Current.Web; //this returns null

   catch (System.Web.Services.Protocols.SoapException exp)
    Logger.WriteLog(exp.InnerException.ToString(), "wss login error");
   return isvalid;


Please Help. Thank you.



SPContext.Current.Web.CurrentUser is null


I am using FBA in an internet zone of sharepoint site.

I am getting null in Current.Web.CurrentUser object even when i am logged in as FBA User. The welcome message is shown on top to ensure that FBA is working, but CurrentUser is giving null.

The same code works perfectly when logged in as Domain user in Intranet Zone.


SPContext.Current.Web.CurrentUser null in application page on 2008 r2 server

With my current situation I have:
a wss3 development environment on a 2003 R2 server
then a production 2008 r2 server.

For some reason on the 2008 server the SPContext.Current.Web.CurrentUser object is null for users who are site collection administrators but may not have permission to log into the server itself; however, on the 2003 R2 server the code works fine for those users.
When googling around, I had seen something about nt permissions on the bin folder sometimes being and issue until asp.net cache picks up the dll but this is a page in the _layouts directory and the code is in the .aspx page itself. It works fine for me as a system administrator on either machine.

Any suggestions? Thanks.

SPContext.Current returns a null


ok, I am new to the wonder world of WSS and Sharepoint.   The objective of my code is to upload a file into a particular folder into a document library.   Well, I was able accomplish this task ( ONCE ) on a Virtual machine but something happened somewhere and the code below no longer works:


public string UploadFile(string folderName, string fileName, byte[] contents)

{            String retVal = "File : " + fileName + " Upload Successfull.";


Use Silvelight Form as Edit page ClientContext.Current is null



I've created a custom content type and set a xap as edit form and new form.

this edit/new form of course gets open in the classic SharePoint Dialog.

the problem I have is that the ClientContext.Current is null in this context (Silverlight in Dialog)

I get a context when I host this xap in the Silverligth Web Part

what's wrong ?

properties of SPContext.Current returns null after migration



I use stsadm export to migrate my site from one machine to another. After migration, I found one of my webpart does not work. It throws a null reference exception.

I logged my webpart and found it cannot get SPContext.Current.Web and SPContext.Current.List, the both returns null and cause the exception. I removed the webpart and added it again but the exception still occured. However, I created a new List on the new site then put my webpart in and it works fine.

I think it is because my migration operattion, is there anything need attention during migration?  Why SPContext.Current cannot get properties?

HttpContext.Current is null - when HttpContext.Current.Request.ServerVariables["SERVER_PORT"] is us


HttpContext.Current  is null - when HttpContext.Current.Request.ServerVariables["SERVER_PORT"] and HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"] used.


This is in .asmx (2.0 framework) section. All i am trying is getting a server port # & validating some stuff.


Exception:  HttpContext.Current.Request.ServerVariables["SERVER_PORT"]    'System.Web.HttpContext.Current' is null   


Any thoughts?





Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).

How to check for null/empty strings on dynamic objects?


What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:

if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)

If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?

Registering controls of current assembly object reference NOT set error


Hi There,

I have created a simple ASP.net Web Application (2.0) and have added a web user control.

Now in my page I have added this control but I have registered like this,

<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>

Which means I want to access all the controls in my current Web Application project

Then I have added my user control like this,

<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />

Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"

Note that My Control has,

1) Public property PublicProperty as String

2) 1 Label control

In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).

I don't want to register my control using Src, TagPrefix etc. Any ideas?


Merge SQL to Excel--Need .Net button to open on fly and have current SQL data!


           Hello all,
I do not know if this is the proper place to ask this, but my question is...
I have a SQL DB and I want to convert it to Excel Sheet (I did this using the wizard)!
In my aspx page I have a button.  So when I press this button I want the Excel sheet to open!  But I need the Excel sheet to show me the up to date information that is in the SQL DB.  

'element.className' is null or not an object



I just downloaded the project, compiled it and ran it right out of the box and when I put the mouse pointer over or remove the mouse pointer from either MenuItem in the menu demo, I generate this error:

'element.className' is null or not an object

It points to this javascript method:

updateClassName: function(operation, element, name, value) {
        this[operation + 'String'](
                function() {
                    return element.className;
                function(newValue) {
                    element.className = newValue;

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend