Saving The Login Name As Current User Identity?

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


Similar Messages:

Method Is Only Supported If The User Name Parameter Matches The User Name In The Current Windows Identity?

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

HttpContext.Current.User.Identity.Name With And Without Www?

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

Security :: Unable To Retrieve Current.User.Identity.Name In II7

Feb 26, 2010

I'm in the middle of moving a web application from IIS6 to IIS7. I've enabled "Windows Authentication" and added <deny users="?" /> to the authorization section of my web.config file. When the app was running on IIS6 my users where able to access the web app without logging in because their windows login was automatically recognized. This does not seem to be the case in II7. I can not get a value for "Current.User.Identity.Name" in my ASP.Net code.

View 1 Replies

C# - Storing Extended Identity In HttpContext.Current.User?

May 14, 2010

I have created an ExtendedId class which extends GenericIdentity. (This stores Id as well as name)

In a httpmodule I stored this extended id in Current.User like so:

HttpContext.Current.User = new GenericPrincipal(myExtendedId, roles);

Problem is, later, how do I get at my ExtendedId type again?

If I try this:

ExtendedId eId = (ExtendedId)HttpContext.Current.User.Identity;

View 2 Replies

HttpContext.Current.User.Identity / Is Possible To Create Another Property Like 'userid'

Jul 8, 2010

is possible to create another property like 'userid' as i can access like

HttpContext.Current.User.Identity.userid ? if yes , how? (actualy last year i did something like this but i have forgotten

View 1 Replies

Security :: Httpcontext.current.user.identity.isauthenticated Always False?

Sep 7, 2010

I create two pages, the first one is the login page with user name and password textboxes - (not asp login control) , when clicking login button I check the login authentication, if it is true redirect to default page. in the default page if !IsCallBack then i check httpcontext.current.user.identity.isauthenticated

if it is false i redirect the user to the login page. but my problem is that the httpcontext.current.user.identity.isauthenticated is always false.

Below the section of authentication in web config

[code]....

View 5 Replies

Security :: Forms Authentication Cookie Not Changing Current User Identity

Jan 21, 2010

I am having a problem with security in a web application I am building using Visual Web Developer 2008. I am using Forms Authentication:

<authentication mode="Forms">
<forms name=".MYAUTH" timeout="20" enableCrossAppRedirects="true" />
</authentication>

And a SQL Server database with ASP.NET Membership and Roles. I am using the LoginView control with the AnonymousTemplate and LoggedInTemplate to manage the user's interaction with logging in and out. The problem I am having is that I am authenticating the user against the database:

If Membership.ValidateUser(_userName, _txtLoginPass.Text)
Then returns True and:
FormsAuthentication.SetAuthCookie(_userName, False)
sets the cookie correctly:
FormsAuthentication.Decrypt(FormsAuthentication.GetAuthCookie(_userName, False).Values(0))
{System.Web.Security.FormsAuthenticationTicket} CookiePath: "/"
Expiration: #1/21/2010 1:42:27 PM#
Expired: False
IsPersistent: False
IssueDate: #1/21/2010 1:22:27 PM#
Name: "jaymo "
UserData: ""
Version: 2
but when I check
HttpContext.Current.User.Identity.IsAuthenticated it always returns False.
If done this before and it worked fine. I cannot find any mistake I might have made or where something might have changed between ASP.NET 2.0 and 3.5.

View 2 Replies

Security :: HttpContext.Current.User.Identity.IsAuthenticated / Module Isn't Working

Jan 18, 2010

We have an SharePoint site no login (anonymous) with a search module using AJAX. Now the users complains that the module isn't working. When I check the code (not developed by me), I find that the code only runs if "HttpContext.Current.User.Identity.IsAuthenticated=true". Could that ever return true on an anonymous site?

View 1 Replies

Security :: Creating Another User Without Changing Login Identity?

Apr 23, 2010

I wanted to be able, as an administrator, to create new users using the createuser wizard. When I use the wizard to add a new user, however, I end up logged in as that user, instead of as my admin account. How do I prevent from being logged in as the user I just created?

View 2 Replies

Web Forms :: Get Currently Login Windows User Identity In Application

Jan 4, 2011

I have this web application where I need the currently logged in windows user Identity. I server on which I deployed this application does not support virtual directories. And I am not sure if that server is configured for "Integrated Windows Authentication."

I tried using:
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Request.ServerVariables["AUTH_USER"];
HttpContext.Current.User.Identity.Name;

All these work and retrieve the appropriate currently logged in windows username when the application isn't deployed. But when I deploy it on this particular server, these methods do not give me nothing.

View 4 Replies

Security :: Set Context.User.Identity.name When Using The Login Controls?

Jun 13, 2010

To avoid going to the Databse to get the user Id, Id like to append userId to the Context.User.Idenity.name field. This way I can split the returned string to get the UserId without going to the database.

Where can I do this when using the login controls?

Is there some event handler where I can add:

FormsAuthentication.SetAuthCookie(NamePlusUserID, false);

View 1 Replies

How To Make The Current User Authenticated Without Login

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

Security :: Get The Avatar (property) Of The Current Login User?

Oct 1, 2010

I am using .net membership. i got my login page where i want to get the avatar (property) of the current login user and save in a cookie but dont know how can i achieve that?

[Code]....

View 1 Replies

Security :: Authenticating User - Textbox Shouldn't Display Current Windows Login Name

Jun 3, 2010

I am using Login control and validationg the user against SQL datasource. below is the code:

Protected
Sub Login1_Authenticate(ByVal sender
As
Object,
ByVal e
As System.Web.UI.WebControls.AuthenticateEventArgs)
Handles Login1.Authenticate
e.Authenticated = IsValidUser()If IsValidUser() =
True
Then
Response.Redirect("Orders.aspx")End
If
End
Sub
Here is IsValidUser
Private Function IsValidUser() As Boolean
Try
Dim sql As String = String.Empty
Dim RecCount As Integer = 0
sql = "Select count(*) from UserLogins where UserName='" & clsDB.RemoveQuote(Me.Login1.UserName.Trim) & "'"
sql = sql & " AND UserPass='" & Me.Login1.Password.Trim & "'"
RecCount = clsDB.ExeScalar(sql)
'If Invalid ==> 0 means no record is being returned by Query
If RecCount = 0 Then
IsValidUser = False
'MessageBox.Show("Invalid User Name/Password.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Exit Function
End If
If RecCount = 1 Then
IsValidUser = True
Exit Function
End If
'Error handler
Catch ex As Exception
End Try
End Function

Here comes the problem validation code is working fine and it validates the user and redirects the user to the "Order.aspx" page

For example: I type
Login Name: Nashy
Password: 1234

Order.aspx page has a textbox which supposed to display the current user login name and i am usiong the following code for that

textbox1.text=Web.HttpContext.Current.User.Identity.Name.tostring()

when i test it on my local PC it shows the current user like this DOMAIN ashyMastrew.. what i want that the textbox should disply "nashy" not my current windows login name. and when i deploy it to the server and access it from other pc textbox does not show anything.

View 5 Replies

Security :: When Use Clicks On Logout Button The Current Session Is Closed And User Is Redirected To A Login.aspx Page?

May 4, 2010

I have written custom code for login and logout...When use clicks on logout button the current session is closed and user is redirected to a login.aspx page...The problem is that when a user click a back button on internet explorer it the previous page he was navigating is shown to him...(altough he cant perform any operation as session is null and their is condition in page load that if session is null user should be redirected to login page)May i have to clear cache of client ??

View 3 Replies

C# - How To Get At The Current Users Windows Identity

Mar 8, 2011

The site is running on my local IIS 6.1. I Would like to add some features to pull information from our AD. My AD code works on many other projects and on my dev server. Here are my attempts at writing out the username:

Response.Write("1. " + this.Request.LogonUserIdentity.Name);
Response.Write("2. " + Request.ServerVariables["Auth_User"]);
Response.Write("3. " + WindowsIdentity.GetCurrent().Name.ToString());

The results I get are:

NT AUTHORITYIUSR
administrator
NT AUTHORITYNETWORK SERVICE

How can I get at the actual windows username like ourdomain/username

View 5 Replies

Using EWS From Within A Website, Is It Possible To Use The Current Logged In Users Identity?

Feb 20, 2010

I have a web application using Forms authentication provided by AD. I would like to know if it's possible to use EWS to send mail as the currently logged in user without having to supply credentials, or; would I be required to set up an account with impersonating access which will send mail on behalf of the currently logged in user?

View 1 Replies

DataSource Controls :: How To Get The Current Identity Number When Doing Insert

May 20, 2010

The scenario is that I wanna insert a record to the database via INSERT query and I need to user the identity number of this record in the INSERT query.

But I don't know how to achieve this.

Here is my table structure and code for your better understanding.

There are three columns in the Table: categoryID, categoryName, categoryPath. I need the path based on the categoryID which is an identity int column.

Now I used this code to do INSERT:

[Code]....

View 6 Replies

Which One Should Use For "anonymous User Identity" - "specific User: IUSR" Or "application Pool Identity"?

Feb 2, 2011

In IIS Manager center pane, there is an icon titled "Authentication" as follows: Clicking the icon, we get 3 items as follows: Right clicking the Anonymous Authentication and select edit, we have: Question: which one should I use? What is the difference?

View 3 Replies

VS 2005 - Current Identity (Butterfly-PCWebsite) Does Not Have Write Access

Jan 10, 2010

I got this error when I try to browse my default.aspx and I think this problem cause from my web.config. Take a look on my web.config file.

The current identity (Butterfly-PCWebsite) does not have write access to 'C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files'.
Exception Details: System.Web.HttpException: The current identity (Butterfly-PCWebsite) does not have write access to 'C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files'.

Code: <?xml version="1.0" encoding="UTF-8"?> <!--
Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in WindowsMicrosoft.NetFrameworkv2.xConfig
<configuration>
<appSettings />
<connectionStrings>
<add name="csACC" connectionString="server=localhost;User Id=root;Persist Security Info=True;database=acc" providerName="MySql.Data.MySqlClient" />
<add name="csAgent2" connectionString="server=localhost;User Id=root;database=acc" providerName="MySql.Data.MySqlClient" />
<add name="masterConnectionString" connectionString="Data Source=BUTTERFLY-PCSQLEXPRESS;Initial Catalog=master;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<!--

Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions where data loss can occur.
Set explicit="true" to force declaration of all variables. -->
<compilation debug="true" strict="false" explicit="true" />
<pages>
<namespaces>
<clear />
<add namespace="System" />
<add namespace="System.Collections" />
<add namespace="System.Collections.Specialized" />
<add namespace="System.Configuration" />
<add namespace="System.Text" />
<add namespace="System.Text.RegularExpressions" />
<add namespace="System.Web" />
<add namespace="System.Web.Caching" />
<add namespace="System.Web.SessionState" />
<add namespace="System.Web.Security" />
<add namespace="System.Web.Profile" />
<add namespace="System.Web.UI" />
<add namespace="System.Web.UI.WebControls" />
<add namespace="System.Web.UI.WebControls.WebParts" />
<add namespace="System.Web.UI.HtmlControls" />
</namespaces>
</pages>
<!--
The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. -->
<authorization>
<allow roles="administrators" />
<deny users="*" />
</authorization>
<!--
The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors> -->
</system.web>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>

View 3 Replies

Installation :: Error - Current Identity Doesn't Have Write Access

Jun 28, 2010

I have installed and repaired .NET 4.0 already, and I can not figure out why IIS will not run 4.0 applications. I am running Windows 2003 R2, Sp2. IIS 6.0 I created a new ASP.NET Application in Visual Studio 2010, and published it to a site on my IIS. In IIS, I have selected it to run with 4.0, and my web.config also says to compile in 4.0 My First error was : Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. (C:Inetpub...web.config line 22)

After some research, I found that my IIS had no v4.0 Web Service Extension setup. I thought this was odd, but I manually added it. New error was : The current identity (NT AUTHORITYNETWORK SERVICE) does not have write access to

C:WINDOWSMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files'.

After some research, I found I needed to add this folder, and give all rights to it. I know something is wrong, I shouldn't have to do this. My application is still erroring.. failing to load my ReportViewer :

Exception message: Could not load file or assembly 'Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

My research and I think my aspnet_regiis did not run properly.. so I trieto run this myself: but I get this error!!

-aspnet_regiis.exe - Application Error

-The application failed to initialize properly (0xc0000005). Click on OK to terminate the application.

View 5 Replies

Error - The Current Identity (NT Authority/Network Service) Does Not Have Write Access...

Jan 17, 2011

i developed a simple web application. A label and a button. On click of Button, the label will display Hello World.

When I deploy this web application on my web server and access the URL, I get this error message.


The current identity (NT Authority/Network Service) does not have write access to C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Files

I have tried the following -

Navigate to C:WindowsMicrosoft.NETFrameworkv2.0.50727 and typed the following command -

aspnet_regiis -ga "NT AuthorityNetwork Service"

After that also, it did not work.

We checked the permissions of the folder Temporary ASP.NET Files and for the Network Service user, we checked the Security Permissions and it has all the permissions as required.

View 1 Replies

Installation :: Web Publish / The Current Identity (NT AUTHORITYNETWORK SERVICE) Does Not Have Write Access?

Oct 8, 2010

i try to publish my application , below the error i have, iam using

vista home edition

The current identity (NT AUTHORITYNETWORK SERVICE) does not have write access to 'C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Tem porary ASP.NET Files'.

View 4 Replies

Saving Text In The Current Page Being Viewed

Jul 7, 2010

Is it possible in VB.NET to change defaults settings on a page? For example I have..

Label1.Text = "Hello World!"

This is my code on the page load, now I want to give the user the ability to change that to whatever they want after clicking a button. So someone types "Hello!" and presses the button, how can I make it save the file with "Hello!" instead of "Hello World!" so that everyone else who comes after that user will see "Hello!" and not "Hello World!"? Basically I need to know if it is possible to edit the page using that same page.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved