Security :: Membership.GetUser() Using FireFox Browser
Jun 2, 2010
I am finishing up my asp.net web application targeting .net 4.0. I am using VS2010.
I have deployed my application to a host server and now I am testing with multiple different browsers.
The first issue I ran into comes down to the following code:
[Code]....
If I use IE, login and click something that causes the above code to execute then currentUser is NOT null. However doing the exact same steps in FireFox currentUser is null, even though I know I am logged in as my name and other indications on the webpage confirms I am.
------------------------
Update
----------------------
Since originally posting this thread I have done more testing.
I placed a test button on a random page and the button click will update a label on that page indicating if the currentUser is null or not. This button works both in IE and in FireFox. Also both running locally and running on the host server.
----------------------
So now I am looking at what is different about the one place it appears not to work so let me try to make this clear.
I use a component called Uploadify to upload images into a database. That component calls a page/request called ImageUploader.ashx which inherits from IHttpHandler. Here is all the pertainent code from that file.
[Code]....
The problem is when calling from FireFox, imgProvider.Status = null. This is a problem because the ImageProvider will try to insert a record into my database and the column for Status cannot be null so that causes it to crash. I made the change to detect if Status = null and return the user id if so as an error message to help me debug. To understand how Status is set you only have to look at a little code in the ImageProvider class:
[Code]....
You will notice when the ImageProvider is created it calls ClearFields(). Inside ClearFields() is where it gets the currentUser and if not null it sets the UserID property, which case the setter for UserID must set Status to either Approved or Pending. Whats happening is ONLY in FireFox, and after more testing, ONLY on the host server does currentUser = null even when I am logged in. but in other areas of code I can get currentUser and it works, also this works fine with IE, it also works fine with FireFox running locally. So I have icolated it down to this specific piece of code, when using FireFox, when running on Host server.
View 9 Replies
Similar Messages:
Sep 22, 2010
i have add a new column (CustomeAuth) to aspnet_Users but i need to get the value of this column just like:
Membership.GetUser().UserName
so i can use :
Membership.GetUser().CustomeAuth
View 3 Replies
Oct 16, 2010
I have an Employee class in my App_Code folder. On my login page I am trying to create an Employee using the asp.net username as a parameter in my Employee constructor.
I have tried creating the employee in the page load event when it is a post back. I have tried doing it in the Login1_LoggedIn event. For some reason I cannot pull the username in either one of these places, but if I redirect after logging in and do the same thing on another page, it works.
How can I get it done on the login page?
[Code]....
View 3 Replies
Jan 10, 2011
I have an application that has been running for about 1.5 years. Suddenly, I got a bug report that the support team are receiving an InvalidCastException in the User ManagerUnable to cast object of type 'System.Guid' to type 'System.String'. The line this appears to be happening on is:
string queryStringID = Session["EditID"].ToString();
Guid providerUserKey =
new
Guid(queryStringID)
MembershipUser user =
Membership.GetUser(providerUserKey);
<--- here
This is a rather strange error as the value of the queryStringID is in fact a Guid generated by the Membership.GetUser(UserName).ProviderUserKey on the previous page. It doesn't seem to make any sense at all. I'm using the built-in SqlMembershipProvider with no changes. It's as if it isn't picking up that it should be using the overloaded function Membership.GetUser(object providerUserKey)Anyone else ever seen anything like this? I wouldn't normally post here unless I was absolutely stuck but I can't seem to find any relevant information by Googleing this one. Also, it's just started doing this. There was never an issue before. Very strange
View 5 Replies
Mar 29, 2010
I have strange problem with the membership provider on my mvc application.
I have a webforms page inside admin folder which calls the following code in the models directory.
public int SaveUploadedFile(HttpPostedFileBase fileBase)
View 2 Replies
Feb 23, 2010
I have a TableAdapter that queries a table by UserName. The TableAdapter works fine if I preview data and supply a username. I'm trying to become more familiar with BLLs . I can't find any good examples on using the BLL as the datasource and supply the membership.getuser().username to the DAL. Here is what I tried so far, but membership.getuser can not be a string.
Imports DataSet1TableAdapters
Public
Class UserProfilesBLL
Private UserProfilesAdapter
As UserProfilesTableAdapter =
Nothing
Protected
ReadOnly
Property Adapter()
As UserProfilesTableAdapter
Get
If UserProfilesAdapter
Is
Nothing
Then
UserProfilesAdapter =
New UserProfilesTableAdapter()
End
If
Return UserProfilesAdapter
End
Get
End
Property
Public
Function GetDataByUserName(ByVal
serName As
String)
As DataSet1.UserProfilesDataTable
Dim u
As MembershipUser
u = Membership.GetUser().UserName.ToString
Return Adapter.GetDataByUserName(u)
End
Function
End
Class
View 2 Replies
Apr 29, 2010
What are the differences between Membership.GetUser() and Context.User, and which is recommended for use in getting information about the current user?
View 2 Replies
Oct 27, 2010
I am using forms authentication in asp.net application. This is working fine in internet explorer. Opening application in firefox is also fine but when i login in second instance of firefox, application in first instance logs out. Following is my code for creating ticket and cookie.
FormsAuthenticationTicket objTicket = new
FormsAuthenticationTicket(1, sUserName,
DateTime.Now,
DateTime.Now.AddMinutes(60),
false,
"");
HttpCookie objCookie = new
HttpCookie(FormsAuthentication.FormsCookieName);
objCookie.Value = FormsAuthentication.Encrypt(objTicket);
objCookie.Expires = DateTime.Now.AddHours(1);
HttpContext.Current.Response.Cookies.Add(objCookie);
View 1 Replies
Jan 24, 2011
This error is occuring randomly, and I can't seem to pinpoint what is causing it. For the most part, the code works fine. I'm confused why it works sometimes, but then suddently craps out on me, lol.It happens in the code when I call upon the asp.net membership provider. It only seems to happen when i use Membership.GetUser() to grab the logged in user's information.
View 9 Replies
Dec 2, 2010
This has got to be simple so I am just going to post my code and then list the error I am getting:
[Code]....
When I do a build I get the following error message:
The type or namespace name 'GetUser' does not exist in the namespace 'ScoutingAssistant.Membership' (are you missing an assembly refrence?)
Now if I change Membership.GetUser() to System.Web.Security.Membership.GetUser() it works just fine. But I thought by adding:
using System.Web.Security;
to the top of the unit would prevent me from have to prefix Membership but it seems to be ignoring my using statement.
View 4 Replies
Dec 21, 2010
i've log-in page in my site but log-in control doesn't work on any browser other than IE.
View 1 Replies
May 25, 2010
In web application I'm using devexpress toolkit, and have the right (correct) result in IE only (using also some java-script), on clicking event for example is working in chrome and safari, but in Firefox and Opera not
The grid view are not showed properly in division in any other browser, except IE!
View 2 Replies
May 19, 2010
I have a asp.net page which is checking a UNC path on a listbox item change event using Directory.exist method.
This works fine in Internet explorer.
But when i use firefox and debugging this method returns false even though the directory exists.
What could be the reason for this strange problem.
this is the code
Directory.Exists(@\SYSMHARSYSxxxxxxFilesRegionError)
when i browse from IE and put a breakpoint here it returns true.But in FF the same code returns false.Its happening only for a UNC.It returns true for a local path(eg Directory.Exists(@C: est).
Authenticatiion:
authentication mode="Windows"
identity impersonate="true"
View 2 Replies
Jan 20, 2010
when i click the link button in Masterpage the window has to close. This function is working properly in IE but in fireFox or chrome or Safari Other than IE in all browsers postback is happening.
my code :
[code]....
View 1 Replies
Apr 16, 2010
I have a dropdown list placed in Update Panel the issue is that when i am trying to make selection from the dropdownlist i am not able to select the items under it(i.e. after clicking on the dropdownlist the items get displayed but when i move the mouse over it the dropdownlist gets closed).
This issue is observed in Fire Fox only (works fine in IE and Google Chrome).
View 2 Replies
Apr 4, 2011
The function window.opener.location.reload(); is working fine with IE but not refreshing parent page in mozilla firefox browser. how to refresh parent page in cross browser/browser independent.
i have got this function:
[code]....
View 1 Replies
Apr 3, 2011
This thing has just came to my head and I wanna share it.Note : I could easily test it but I am being lazy here to see if anybody has ever experienced something like that before.Let's assume that I have a web site which built-in membership structure of asp.net has been implemented on. What will happen to asp.net membership if the client browser blocks cookies? Does framework throw an exception when a user tries to log in or do something else?
View 3 Replies
Sep 9, 2010
I'm working on a website where it should be possible for registered users to upload word documents. The administration of users is done through Membership and Profiles. When the documents have been uploaded, the following needs to be achieved:Non-registered users should not be allowed to download documents I should be able to control which users that has access to which documents I should be able to register which user downloads which documents I should be able to track how many times a document has been downloaded
Can this be achieved be using Membership and Profiles?
View 1 Replies
Feb 28, 2011
I'm trying to use the Membership.CreateUser method without passing a security question and answer. I set them to string.empty, but no go. I have my provider set to not require a question in my web.config. What am I doing wrong?
[Code]....
View 2 Replies
Feb 9, 2010
In our application, we have a need for a user to "impersonate" a different user. Think of it as a hierarchy -- Bob is above Frank in a hierarchy. Bob is logged in, and he needs to do things in the system for a short time as Frank. So, we have given Bob a list of users that report to him, and an impersonate link. He clicks on this link, and, behind the scenes, I log Bob out, and log in as Frank. I also set a session variable that tells me that really Bob is they guy who is the user. Also, Bob (acting as Frank now) has a nice little link at the top of every page that says "Stop Impersonation."
In addition, when Bob is impersonating Frank, Bob is restricted from doing some things, like changing Frank's password.
This was working great, until we encountered a situation where, if the session (I think -- getting confused here) gets destroyed (such as when I copy up new code and dlls to the live site), then when Bob clicks on "Stop Impersonation" he gets redirected to the default page, and is still logged in as Frank, but without the Impersonation session variable. So, now Bob really is logged in as Frank, and can change Frank's password (among other things).
How is it that a session variable (Impersonation) gets destroyed, but I guess the session is still hanging around, because it doesn't make the user log in again?
This is a somewhat serious bug for how our system works (bug in our code, I'm sure, not in .Net). We are using ASP.Net c#, aspnet membership services, .net 3.5, forms auth...not sure what else you need to know.
EDIT: Updated information. Looks like when "something" happens, for instance, when I recompile some dlls and copy them to the webserver, the session gets dumped. Or, rather, the variables in the session get dumped. The session id stays the same. I do get to check for Session.IsNewSession and it returns true, even though the id is the same as it was before.
Just like Utaal mentioned, Membership Services is separate from Session, so it's forms auth token is still hanging around in the browser, but my session variable telling me that that isn't really the user who is controlling the browser isn't there anymore.
EDIT: Sky, here is what I'm doing to authenticate a user. I can't figure out where I would insert a ticket into this flow:
if (Membership.ValidateUser(txtUserName.Text, txtPassword.Text))
FormsAuthentication.SetAuthCookie(txtUserName.Text, false);
View 2 Replies
Jan 5, 2011
This is my first membership provider; I converted the sample provider [URL] to SQL. I created a vb class provider and put it into the App_Code folder. After it was created I tried to modify my webconfig but the error pops up. I don't know what else to try, I don't know if I have missed something
webconfig:
[code]....
View 1 Replies
Feb 9, 2010
I have started to implement asp membership. I go the administration page and click provider. I have a database on a server on the local network that i want to install my members tables in. When i run the
aspnet_regsq.exe it doesn't ask me what SQL database i want to use and seems to default to my local SQL Server 2005 installation. How I change this to use my SQL Express database on a local server?
View 6 Replies
Aug 10, 2010
I have to implement a small webshop. Basically it's just a website with a huge backend ERP System and with the possibility to sell one (yap, really only one!) product on the website. The only requirement is a MySQL Server. The backend is almost finished (about 95%) and is secured with the .net MemberShip Provider for MySQL (the one in MySql.Web from the MySql Connector .NET).
Now to my question: I can set up the membership system easily but I do not need such things like username or password-question but I would need a reference to an address table to store the users home address. So, it is possible to change or customize the membership system to for eg. a unique customer id instead of the username column and set this in codebehind when the user is creating a new account? And is it possible to insert new users/customers from codebehind in an easy way? (I mean without checking each foreign key and inserting the customer reference to the userinrole table and so on...)
View 10 Replies
Apr 14, 2010
I am building a site and I want to use the default membership controls provided with asp.net like Login View Control etc. I don't want to use the ASP.Net Membership DB as I want to use my own Security structure and I don't want to inherit the ASP.Net membership class either. In my case how can I use these controls to aid me like how will a login view control detect if someone is authenticated or not.
View 7 Replies
Sep 26, 2010
I'm try to get my site to detect what browser someone is using to ensure they're using one that is compliant with our site. Everything works, except Firefox seems to post the wrong version in the Request.Browser variables.I'm on Firefox 3.6.10, but Request.Browser shows Mozilla 1.9.2.10. It's correct in the HTTP_USER_AGENT string:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.10) Gecko/20100914 YFF35 Firefox/3.6.10 ( .NET CLR 3.5.30729)
Is there a way to detect it better without having to parse through the HTTP_USER_AGENT string?
View 3 Replies