NopContext.Current.User Is Always Null?
Nov 3, 2010
I've been developing an application based on nopCommerce 1.60. I'm developing on Windows 7 Pro 64bit.
I'm deploying the application to Windows server 2003 R2 (32bit) for staging and this works fine. It works perfectly and exactly like when I run it on the Visual Studio dev server.
I've just deployed the code to the live server for testing in that environment and I've got a real show stopper. NopContext.Current.User is always null!
The live server is Windows 2003 R2 64bit, and this is the only difference I can see. I've been through every page of the site settings in IIS on both servers and made sure every setting is the same, I've also done the same for the Application Pool.
View 2 Replies
Similar Messages:
Feb 5, 2010
Is it safe to always assume that HttpContext.Current will be non-null in Application_PreRequestHandlerExecute?
EDIT: Assuming ASP.NET webforms (not MVC).
View 2 Replies
Aug 20, 2010
I am getting HttpContext.Current.Session is null.Will this be a problem if we have application hosted in web farm.
View 1 Replies
May 24, 2010
I am trying to set up a jsonp instance in WCF.
I am getting the following error
WebOperationContext.Current
Object reference not set to an instance of an object.
View 2 Replies
Jan 17, 2011
i'm storing in HttpContext.Current.Session current user, SiteUser is single-tone class that presents current active siteuser, and when he logged i'm creating new SiteUser() in controller and in constructor adding him to the session:
[Code]....
then, with every request to the server services i'm check is user available in session:
[Code]....
otherwise i'm generate non-auth-user exception and redirect him to the logon page. but sometimes HttpContext.Current.Session[sessionKey] is null, but HttpContext.Current.Session doesn't null and FormsAuthenticationTicket is available and Expired property is also false. can somebody help me, why HttpContext.Current.Session[sessionKey] can be null?UPDi have downloaded symbol tables of source .NET Framework and set breakpoints at SessionStateItemCollection on changing collection items. and i resolved some mistakes:1) all collection items are null — "culture" is setting up after2) it happens at the session end eventi can't understand how it can be, because at web.config session timeout is set 20
View 20 Replies
Mar 10, 2010
I have an ASP.NET Web Forms app using Entity Framework in the data layer. I've recently changed the app over to use one Object Context per request as per this post. It works great for the entire application except for any page which uses a ReportViewer to display something.
I've noticed that it fails when trying to get an instance of the [Code].... from the [Code].... collection because [Code]....
is null.
Microsoft.ReportViewer.WebForms.dll and Microsoft.ReportViewer.Common.dll can also be seen in the call stack each time it fails. The reports each use one or more ObjectDataSources to retreive data.
Based on this I'm assuming that the ReportViewer is somehow to blame, but i have no idea why. I would need some way to dispose the ObjectContext after it had been used by the report at the very least.
View 1 Replies
Nov 15, 2010
I'm using VS2010 and created a simple asp. web forms application, using Development Server to test it. I try to store user data - queried from sql server - in the session, since I don't want to access database in every request. I'm using the 'Application_AuthenticateRequest' and the 'Session_Start' methods.
First round:
AuthenticateRequest called. The following code ran:
[Code]....
The _current variable is a private static field published through a static property. In the first round the Session is null, and I think it's ok because the Session_Start not called yet. The Session_Start looks like this:
protected void Session_Start(object sender, EventArgs e)
{
Session["EMPLOYEE_DATA"] = EmployeeFactory.Current;
}
In the next round the Session_Start is not called of course but in the AuthenticateRequest I can't access to the session. The HttpContext.Current.Session is null and the this.Session reference throw a HttpException says the "Session state is not available in this context".
However I can access the Session from any of the page_load events but it's a bad practice I think that I put authentication every page_load.
View 1 Replies
Aug 19, 2010
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 sessionAs 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 understand there are many reasons that may occur. What I'm trying to figure out is, is there any way to re-establish the context once it is null? If not, is there anything I can do at this point other than have the user login again? We're also trying to figure out a better way of managing user information (preferences, roles, flags, history, etc), but everything needs context to use, right? Cookies, sessions, cache, etc. all require a response or request, correct? hope this makes sense, because I really need help with this. I've searched the forums here, and found many posts about HttpContext.Current going null, but not a lot of solutions for this...
View 14 Replies
May 20, 2010
1. SetSession.aspx page sets value for a session variable and redirects to default.aspx page using Response.redirect() code.
2. Default.aspx page tries to create an object of class in app_codecommon.cs file.
3. In app_codeCommon.cs file, I am trying to access the session variable set in step1 using HttpContext.Current.Session object.
but step 3 gives error that object reference not set to an instance. as HttpContext.Current.Session is null.
I surf abt it on net, and seems to be problem with asp.net framework.
View 1 Replies
Jan 30, 2011
get the below error. My application was working fine until I probably modified something, but don't know what.
Server Error in '/' Application.
Method is only supported if the user name parameter matches the user name in the current Windows Identity.
Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Configuration.Provider.ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ProviderException: Method is only supported if the user name parameter matches the user name in the current Windows Identity.]
System.Web.Security.WindowsTokenRoleProvider.GetCurrentWindowsIdentityAndCheckName(String userName) +2195661
System.Web.Security.WindowsTokenRoleProvider.GetCurrentTokenAndCheckName(String userName) +36
System.Web.Security.WindowsTokenRoleProvider.GetRolesForUser(String username) +61
System.Web.Security.RolePrincipal.IsInRole(String role) +182....
View 1 Replies
Sep 1, 2010
I have an ASP.NET 4.0 application with some simple user controls. The user controls work fine on the design surface (VS.NET 2010), but when they're loaded during application execution, nothing shows up.
Futhermore, the various child controls of the user controls are null when referenced inside the code behind for the user control.
The code behind for the user control executes as expected, but any reference to child controls are null.
It's like ASP.NET is never parsing the ASCX to create the instances of the child controls.
View 4 Replies
Jan 28, 2010
IIS is utilizing the current logged-user's credentials to access an ASP.NET application. Is it possible to create a login page on the application and pass another users credentials, so that particular web app is run under a different user?
View 1 Replies
Jun 4, 2010
I don't think I understand fully how ASP.NET does inheritance of controls.I have a user control, ucBase, which has an asp.net label in the ascx file. Code behind references the label and it works fine during run time if the control is not a parent for another user parent.
If I have another user control, ucChild, inheriting from ucBase, the label in ucBase's code is always null. ucChild has no controls in its ascx fileThe server controls (like the label) needs to be declared in the ascx file and not created programmatically.What needs to be done for ucBase to see its own controls when it's a parent user control?
View 1 Replies
Apr 26, 2013
I have made a web page in which there is login screen when user login it goes next page but my problem is if i directly enter the url of that page it open. I want it should not open unless the user log in...
View 1 Replies
Oct 25, 2010
I thought this would be a simple task as I am trying to get the current logged in domain user name. I have the following:
[Code]....
but it ALWAYS returns nothing ""
Is there some configuration in the ASP that I have to do first?
View 3 Replies
Jan 22, 2011
I want to add a user's GUID in with the information I retrieve from a user when they submit a post. How can I get the GUID?
I am using the default authentication system that comes along with an ASP.NET MVC application.
View 2 Replies
Mar 24, 2011
To get the current logged in user at the system I use this code:
string opl = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
I work on an ASP.net app where I need this info. So I've put my app on a server and tried the code above and I get "Network Service" in the string opl. I need to know the current user of the PC who accesses my ASP.net app.
View 2 Replies
Jul 19, 2010
I'm using asp.net 4.0 with asp.net MVC 2.0 and the asp.net membership provider.
I need to terminate a the user session before I delete it. Otherwise if the user is still authenticated the next time it will visit a page null reference exceptions will occur when trying to access the user data and profile.
I get the Session.Abandon() method but what I'm looking for is the same on a user, something like user.AbandonSessions().
View 3 Replies
Oct 20, 2010
am writing a web service in vb.net/asp.net 2, that needs user's name. It works fine when the url request is "www.mysite.com" but if any one has logged-in using "mysite.com" without a "www" and goes to the page that calls my web service, The HttpContext.Current.User.Identity.Name gives null. How can I resolve this problem?
View 2 Replies
Apr 26, 2010
Im using forms authentication and im trying to get the current username. I tried using Environment.UserName but I am getting "ASPNET". But if i change my application to windows authentication im getting the true username that is currently logged on. How can I get the true username that is currently logged on in the domain using the forms authentication.
View 3 Replies
Sep 26, 2010
I want to log out the user when he (or someone else) logs in from a diferent computer using the same user name.
Basicaly i want to prevent multiple individuals from staying loged in under a single user name by signing out the previous users. Any ideeas about how i can acomplish that ?
View 8 Replies
Apr 21, 2010
how do i ask if the current user have the specific role ...
like ... if(user is in role)
{
do simthing...
}
View 2 Replies
Feb 22, 2011
How to make the current user Authenticated without login.
In other words, what should I do to get true when I ask User.Identity.IsAuthenticated without login?
Should I create a cookie manually? if so, what's its name, what's its value!!
View 1 Replies
Mar 1, 2011
So I'm making a asp.net login. I want the login name that people use to match an id in my SQL database. So that I can retrieve their information. But currently when I use the code below, from which I get the name of the computer I am currently on. However I would like the user Identity to be what they write in the username textbox at the login screen.
If HttpContext.Current.User.Identity.IsAuthenticated Then
Dim userName As String = HttpContext.Current.User.Identity.Name
Response.Write(userName)
End If
So I looked for it on net and I think it might have something to do with my web.config file. As I'm totally new to asp.net I wouldn't know. However here's a part of my Web.config file.
[Code]....
View 3 Replies
May 17, 2010
I have a security manager in my application that works for both windows and web, the process is simple, just takes the user and pwd and authenticates them against a database then sets the Thread.CurrentPrincipal with a custom principal. For windows applications this works fine, but I have problems with web applications.
After the process of authentication, when I'm trying to set the Current.User to the custom principal from Thread.CurrentPrincipal this last one contains a GenericPrincipal. Am I doing something wrong? This is my code:
Login.aspx
[code]....
View 5 Replies