FormsAuthentication Behaving Odd?

Feb 27, 2011

Is this a security issue or by design?string UID = "randomusername" // does not exists in aspnet_Users table
FormsAuthentication.RedirectFromLoginPage(UID, false);Authenticates users, redirects to login page.Profile Page is set to chech User.Identity.IsAuthenticated etc...when they update the profile, it ads the user to the aspnet_users table automatically, which is not what I want.

View 1 Replies


Similar Messages:

Security :: What Is The Difference FormsAuthentication.RedirectFromLoginPage And FormsAuthentication.SetAuthCookie

Mar 16, 2010

What is the difference between:

FormsAuthentication.RedirectFromLoginPage

AND

FormsAuthentication.SetAuthCookie(Text_txtUserName.Text, true);
HttpContext.Current.Response.Redirect(RedirectFromLoginAddress);

View 3 Replies

Dropdownlist Not Behaving Properly When Datavaluefield And Datatextfield Are Same?

Mar 24, 2011

I have a dropdownlist for which I am loading data from excel. Excel has 2 columns Product and Email. Data in Product column is binding to DataTextField and Email column to DataValueField. The dropdown works fine when email is different for different product but when email has same value for different product then whatever I select, on postback the selected value changes to the first item of the same email value.

Below are the sample data in Excel to show the behavior of dropdown

Example 1. (Drop down works fine for this example)

Product Email
iPad prashanth364@gmail.com
iPhone 3G prashanth364@yahoo.co.in
iPhone4 prashanth364@in.com

Example 2. (In the example below, whatever I select (iPad or iPhone 3G or iPhone4) on post back the dropdown selected value will be iPad)

Product Email
iPad prashanth364@gmail.com
iPhone 3G prashanth364@gmail.com
iPhone4 prashanth364@gmail.com

Example 3. (In the example below, when I select iPad the dropdown works fine but when I select iPhone 3G or iPhone4 on post back the dropdown selected value will be iPhone 3G. Basically, on selecting iPhone4 here, on post back it shows iPhone 3G)

Product Email
iPad prashanth364@yahoo.co.in
iPhone 3G prashanth364@gmail.com
iPhone4 prashanth364@gmail.com

Below is the function where I am loaidng the data from excel to dropdown private void ExtractFromExcelInitial()

{
// Put user code to initialize the page here
// Create connection string variable. Modify the "Data Source"
// parameter as appropriate for your environment.
string ExcelFilePath = Server.MapPath("~/ProductExcel") + "\ProductEmail.xls";
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + ExcelFilePath + ";" +
"Extended Properties=Excel 8.0;";

[Code].....

View 1 Replies

Regular Expression Behaving Different On In C# Code Behind And On Aspx?

Oct 25, 2010

I am trying to match an email, however when put the same expression in the code behind, vs the aspx, I seem to be getting different matches for email address. The aspx regex validator seems to be working correctly, however I need to validate for my webservice as well.

Regex regExEmail = new Regex(@"w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*");
if (!regExEmail.IsMatch(contact.emailAddress))
{
//do something
}

View 2 Replies

Login Web Control Events Are Not Behaving As Expected?

Oct 30, 2010

I have an .aspx page that contains an <asp:Login> web control. For authentication, I have another class (MyMembershipProvider) that inherits System.Web.Security.MembershipProvider class.The login process is working fine - i.e. username/password is properly authenticated by the MyMembershipProvider object.

My question is in regards to setting System.Web.SessionState.HttpSessionState.Session variables.After a user has been successfully authenticated (by the MyMembershipProvider class), I would like to create custom Session vars for that user.Initially, I thought I would be able to set the Session variables in the <asp:Login> control's LoggedIn event handler - something like this:

protected void LoginUser_LoggedIn(object sender, EventArgs e)
{
//Get the UserName of the authenticated user
string userName = Thread.CurrentPrincipal.Identity.Name;[code].....

View 1 Replies

Web Forms :: Link In Master Page Behaving Strangely?

Jan 2, 2010

I'm puzzled by the behaviour of two hyperlinks in my Master Page which appear to be identical. The link to ~/Default.aspx in the href in line 5 of the code below causes a 404 error, but the same link in NavigateUrl on line 9 works fine. On the face of it they should both go to the same page. What's different/incorrect about the link on line 5 that causes the problem?

<body>
<div id="wrap">
<!--header -->

[code]...

View 2 Replies

Web Forms :: Checkbox / Checkbox List Not Behaving?

Jan 14, 2010

I am absoluetly confused. My web app has a checkbox list that my code is looking to see if the user checked it. Like I said, very simple stuff... Here's the code:

If (chkLaunch.Items(1).Selected) Then
Launch = 1
End If

The odd thing is that when it gets to this bit of code it just moves right past it like it wasn't checked. The same thing happens when I use a single checkbox (rather than a checkbox list). I've tried a bunch of different ways to make the code work but I'm left to the conclusion that I'm just not telling it to do this correctly. Either that or my project is messed up somehow.I say that my project is messed up because when I add an object to the page in Design mode, it doesn't write the source code. So when I save and close, all the modifications are mysteriously gone. This happens on multiple PC's...So, is the checkbox problem just me not doing something correctly or is my web project messed up?

View 12 Replies

New Website Attach With Existing Website / Where Attached Website Is Behaving As Pluggable?

Feb 26, 2011

1 new website attach with existing website..where attached website is behave as pluggable. and used anywhere in any website?

View 7 Replies

FormsAuthentication.SetAuthCookie?

Aug 15, 2010

the question is how can i delete a coockie that is created with FormsAuthentication.SetAuthCookie?and how can i set the coockie to have more duration?

View 39 Replies

.net - Possible To Programmatically Set FormsAuthentication.FormsCookieName?

Jan 10, 2011

is it possible to set the FormsAuthentication.FormsCookieName in Codebehind(f.e. in Global.asax)? All properties that i have seen that lead to this config-parameter are readonly.

View 1 Replies

.net - FormsAuthentication For Multiple Subfolders?

Sep 9, 2010

When i tried to implement form authentication in various subfolders i am getting an error as follows:it is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

<location path="HelpDesk">
<system.web>
<authentication mode="Forms">
<forms loginUrl="Helpdesk/Default.aspx" />
[code]...

View 1 Replies

Security :: FormsAuthentication.RedirectFromLoginPage In IE8

May 5, 2010

I have the following code in my secure/login.aspx page using .NET 3.5 and VB.NET

[Code]....
[Code]....

I read some articles that mentioned specifying the domain attribute within the <forms tag but that did not seem to work either. e.g.

View 4 Replies

.net - Can't Get FormsAuthentication To Properly Work With WCF?

Apr 15, 2010

I have both the wcf and asp.net project together in the same project. (I'm running on Azure, so this is more convenient).I have this set in the web.config:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
y wcf service is decorated with:
[code]...

View 1 Replies

Security :: What Is The Use FormsAuthentication.user.identity

Oct 7, 2010

what is the use formsAuthentication.user.identity

is it one of the property of page

View 1 Replies

Security :: FormsAuthentication LoginUrl Messing With CSS?

Apr 23, 2010

I have a login page that is set to the loginUrl property in the authentication section of my web.config file. I am trying to reference a CSS stylesheet, but it doesn't seem to be doing anything. Here is my markup:

[Code]....

I am able to do this just fine on my other page. One thing I noticed was when I click on "View Source" and try to click the link to the stylesheet, it doesn't take me there, and instead changes the "action" property of the form element to this:

[Code]....

View 2 Replies

MVC Authorize Attribute + HttpUnauthorizedResult + FormsAuthentication

Jan 26, 2010

After browsing the MVC section on CodePlex I noticed that the [Authorize] attribute in MVC returns a HttpUnauthorizedResult() when authorization fails (codeplex AuthorizeAttribute class). In the source of HttpUnauthorizedResult() from CodePlex is the code (I'm not allowed to enter another URL as my rep isn't high enough, but replace the numbers on the URL above with 22929#266476):

// 401 is the HTTP status code for unauthorized access - setting this
// will cause the active authentication module to execute its default
// unauthorized handler context.HttpContext.Response.StatusCode = 401;

In particular, the comment describes the authentication module's default unauthorized handler. I can't seem to find any information on this default unauthorized handler. In particular, I'm not using ormsAuthentication and when authorization fails I get an ugly IIS 401 error page. Does anyone know about this default unauthorized handler, and in particular how FormsAuthentication hooks itself in to override it? I'm writing a really simple app for my football team who confirm or deny whether they can play a particular match. If I enable FormsAuthentication in the web.config the redirect works, but I'm not using FormsAuthentication and I'd like to know if there's a workaround.

View 1 Replies

Security :: Password Encryption Using Formsauthentication?

Dec 1, 2010

Just a quick question i've been asked to look at enhancing security but encrypting passwords we store in a db table, essentially the data thats linked to the user account isnt sensitive however its more to stop someone reading passwords out of the table directly etc

I've read multiple ways of implimenting hashing etc i've started using FormsAuthentication.HashPasswordForStoringInConfigFile
//create new salt and update the password
Hashtable newInfo = new Hashtable();
newInfo["salt"] = GenerateFriendlyPassword(5);
string tmppass = FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPass1.Text.ToString() + newInfo["salt"].ToString(), "SHA1");
newInfo["passwordHash"] = tmppass;

Generate friendly password returns a 5 char string based on a random position in a valid char array containing a - z and 0 - 9At present the functionality is at page level in the code behind, re this is the forms authentication HashPasswordForStoringInConfigFile function thread safe? Or do i need to look at implimenting this in a different wayCheers appreciate your response as im always jubious about multi threading etc,

View 1 Replies

Security :: FormsAuthentication.SetAuthCookie () Isn't Working

Jan 8, 2010

In my account controller I am calling FormsAuthentication.SetAuthCookie( emailAddress, rememberMe ).

Response.Cookies has my cookie. However, after the redirect the cookie is gone and the request is not authenticated.

View 6 Replies

FormsAuthentication.RedirectFromLoginPage Does Not Return To Orignal URL?

Jan 5, 2010

I reach my login page with the parameter "returnUrl" set to the URL I was on. Then, I login via OpenID (DotNetOpenAuth), and call FormsAuthentication.RedirectFromLoginPage(). The login is successful, however I am not returned to the original page I was on.

I'm having the same problem on logout - when I log out I don't remain on the same page, even though the logout link contains the correct "returnUrl" parameter.

What am I doing wrong?

Here is the code snippet. I am returning EmptyResult() after the call to RedirectFromLoginPage, because I don't really know what to do (see this related question)

using (var relayingParty = new OpenIdRelyingParty())
{
var response = relayingParty.GetResponse();[code]....

View 1 Replies

Call FormsAuthentication.RedirectFromLoginPage 10'000 Times?

Dec 30, 2010

Is it OK to call FormsAuthentication.RedirectFromLoginPage many times?

On login page we test if user is already logged in, and if it is we just redirect him to default page with FormsAuthentication.RedirectFromLoginPage...

Question is if user sets a script that loads login page 10'000 times, would calling the FormsAuthentication.RedirectFromLoginPage that many times make problems?

View 2 Replies

Authorization Denied Message With FormsAuthentication?

Jul 21, 2010

So, I've implemented my IPrincipal.IsInRole(...) and I'm using FormsAuthentication like so:

<authentication mode="Forms">
<forms loginUrl="Login.aspx" name="someName" timeout="600"/>
</authentication>

Then I have a page that requires you to be authenticated and that you have "roleA". This is configured like so:

<location path="SomePage.aspx">
<system.web>
<authorization>[code]...

Now, I login to my web application, but with a user that does NOT have roleA. When I visit SomePage.aspx I get redirected to Login.aspx, the url specified in loginUrl of the forms element. So, my question is shouldn't I be able be specify an authorization denied message or url? If the user is authenticated, but not authorized why would I want to redirect to the login page. It's confusing as hell to the user.

View 2 Replies

Can't Debug / Step-into FormsAuthentication.Authenticate?

Dec 20, 2010

I am having some trouble with active directory authentication using FormsAuthentication in ASP.NET MVC 2 (VS 2010).

As I understand it I should be able to step into/through the Microsoft source code for FormsAuthentication.Authenticate if I check 'Enable source server support' and 'Enable .Net Framework source stepping' in Options->Debug->General and specify 'Microsoft Symbol Servers' in Options->Debug->Symbols.

I have done this and can step into a whole bunch of MS source code, but not FormsAuthentication.Authenticate. The debugger simple steps over it.

If I could step into FormsAuthentication.Authenticate it would make my life a whole lot easier.

View 1 Replies

C# - FormsAuthentication AuthCookie Is Null Only For Some Users?

Jan 14, 2010

I am experiencing a strange problem with asp.net forms authentication. This problem only occurs for 3 users out of 30+ users that have successfully logged in. I am using very basic auth code that I have used many times and have never seen this problem. After the users successfully authenticates and the auth cookie is created, cookie added, and response.redirect to FormsAuthentication.GetRedirect(userid, false) is called. The Application_AuthenticateRequest method in Global.asax is hit.

// Extract the forms authentication cookie
tring cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = Context.Request.Cookies[cookieName];
if (null == authCookie)
{
// There is no authentication cookie.
return;
}

So immediately after a "good" cookie is saved and the redirect occurs the cookie is null. I have run the code through the debugger and the cookie is only null on these 3 users. But the cookie looks the same as the cookie for the many users that login successfully.

View 1 Replies

Prevent Formsauthentication To Block Css And Images?

Jun 28, 2010

I have a project containing an image, css and js folder. I want to make sure no css, image or js is blocked when using formsauthentication.

I know you can do this with the locationtag in the web.config but I was wondering if you could do this otherweise?

this is how I do it right now:

<location path="css">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="images">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>

I'm using asp.net (c#) with iis 7.0.

View 2 Replies

FormsAuthentication.GetRedirectUrl Always Returns The Default?

Nov 22, 2010

I have an ASP.NET MVC app and am using Forms auth. When going to a page that requires authentication, meaning there is an [Authorize] attribute on the controller action, it redirects the user to the login page with a return url like http://localhost/Login?ReturnUrl=/MyAuthorizedUrl.

This is how my config is setup:

<authentication mode="Forms">
<forms loginUrl="~/Login" timeout="2880" defaultUrl="~/" />
</authentication>

This is how I'm getting the redirect url:

var url = FormsAuthentication.GetRedirectUrl( model.Email, model.RememberMe );

This always returns the default url.

View 1 Replies







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