473,804 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Strange HttpContext issue

Hello all

I've got a very weird situation I need help with. I'm building a
solution where I have custom components in a web content management
system using a web store library (API in DLLs). The CMS is using Forms
authentication to verify users when they log in. I log the user in
using the following code:

private bool AttemptLogon( string username, string password )
{
_errorMessage = "";
Customer customer = new Customer();
try
{
if (Customer.Login (username,passw ord))
{

FormsAuthentica tion.SetAuthCoo kie(username,fa lse,
"/boksala");

string redirecturl = (string)Session["oshopredirectu rl"];
if (redirecturl != null && redirecturl != string.Empty)
{
Session.Abandon ();
Response.Redire ct( redirecturl );
}
else
{

Response.Redire ct(HttpUrlBuild er.GetStoreHome Page().ToString ());
}
return true;
}
else
{
_errorMessage = RM.GetString("E RROR_LOGIN_FAIL ED");
return false;
}
}
catch(AccountDi sabledException )
{
_errorMessage = RM.GetString("E RROR_ACCOUNT_DI SABLED");
}

return false;
}

After this is run, and a valid user is provided, the
HttpContext.Cur rent.User.IsAut henticated returns true and all is well.
When I then debug the 3rd party web store API DLL, everything turns
strange! The authentication type is all of a sudden Windows
Authentication, and IsAuthenticated returns false! How can this be? Is
there any possibility that there are two different HttpContexts? This
is within the same aspx page, and the context should therefore be the
same. I'm not sure if the 3rd Party API does something to change the
authentication mode all of a sudden, and I've searched for any
explanation in vain. Any ideas?

Thanks

Jun 2 '06 #1
1 1308
One good place to start is with the API documentation. Have a look to see
how it handles authentication in a server environment.

--

_______________ _________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------

"Torfi" <to****@gmail.c om> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
Hello all

I've got a very weird situation I need help with. I'm building a
solution where I have custom components in a web content management
system using a web store library (API in DLLs). The CMS is using Forms
authentication to verify users when they log in. I log the user in
using the following code:

private bool AttemptLogon( string username, string password )
{
_errorMessage = "";
Customer customer = new Customer();
try
{
if (Customer.Login (username,passw ord))
{

FormsAuthentica tion.SetAuthCoo kie(username,fa lse,
"/boksala");

string redirecturl = (string)Session["oshopredirectu rl"];
if (redirecturl != null && redirecturl != string.Empty)
{
Session.Abandon ();
Response.Redire ct( redirecturl );
}
else
{

Response.Redire ct(HttpUrlBuild er.GetStoreHome Page().ToString ());
}
return true;
}
else
{
_errorMessage = RM.GetString("E RROR_LOGIN_FAIL ED");
return false;
}
}
catch(AccountDi sabledException )
{
_errorMessage = RM.GetString("E RROR_ACCOUNT_DI SABLED");
}

return false;
}

After this is run, and a valid user is provided, the
HttpContext.Cur rent.User.IsAut henticated returns true and all is well.
When I then debug the 3rd party web store API DLL, everything turns
strange! The authentication type is all of a sudden Windows
Authentication, and IsAuthenticated returns false! How can this be? Is
there any possibility that there are two different HttpContexts? This
is within the same aspx page, and the context should therefore be the
same. I'm not sure if the 3rd Party API does something to change the
authentication mode all of a sudden, and I've searched for any
explanation in vain. Any ideas?

Thanks

Jun 3 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1146
by: Mike | last post by:
I have been receiving this very strange 404 lately and was wondering if anyone else out there has had a similar problem. For some reason when users receive this error and they hit refresh the error goes away. Seems like a IE or ASP.NET cache problem, but can not find any articles on it. 404 not found C:\inetpub\mySite\mySite_com_files\pictures.aspx StackTrace
1
930
by: Sean Nolan | last post by:
I'm wondering if anyone has encountered something similar to the error I've pasted below. We get similar errors when someone hits a bad link etc., but the part I can't figure out here is where the string "ExpenseWatch_files" come from. The page TEPrintFrame.aspx resides in the TE folder. There is no intermediate directory and the string "ExpenseWatch_files" does not exist anywhere in our code. Also, I'm pretty sure that the user never knows that...
5
1944
by: Archer | last post by:
I was making a role-based authentication but it does't login with correct password. the HttpContext.Current.User recieved in Global.asax is always null. Request.IsAuthenticated is always false. in the cs files, i write the code below protected void SubmitBtn_Click(Object sender, EventArgs e) {
15
6746
by: James Higgs | last post by:
For a long time, our product has had a "vanity URLs" feature where nice URLs are mapped to ASPX files in an IHttpModule implementation, using HttpContext.RewritePath(). This has worked beautifully for the past couple of years under .NET 1.1, but when it runs under ASP.NET 2.0 it has problems. Note that this is the case regardless of whether the assmbly is built against 1.1 or 2.0 We're getting the following exception stack trace: ...
3
2950
by: asanford | last post by:
I want to create an ASP.NET web application that receives a form POST message, inspects the data, and reroutes the request to one of many different servers. I wrote an IHttpModule which successfully used HttpContext.RewritePath() to send a request to different pages in one web application, but it gives me an error when I try to rewrite a path to a different web app or server. Does RewritePath() not support this? I can reroute by...
5
1616
by: Developer.Man4 | last post by:
when i try using HttpContext.Current.Server.MapPath(path) from a desktop application built using c# i get a System.NullReferenceException can anyone tell me why and what to do?? m using VS2003 and i have iis 6 installed thanks for time and for ur fast reply
16
2399
by: Victor | last post by:
I have a strange problem in my website. I configured my website to run under 2 worker processes. (web garden enabled). and I stored my user information in the current httpcontext(like Httpcontext.current.items.add("__currentuser", myUserobject") and retrieve the user object like (user = (UserType)Httpcontext.current.items). the website authentication based on the form authentication. and I used login control and customized the validation...
1
5176
by: jbitz | last post by:
Hi, This has got me really baffled. This has got me really baffled. When I run Dim url As String = HttpContext.Current.Request.Url.AbsolutePath.ToLower from Application_beginRequest in Global.asax with server that ships with Visual Web Developer everything works as expected. However, today when I tried to move all code onto IIS server this just doesn't return the same URL! On localhost (Visual Web Developer), variable url is...
2
2019
by: =?Utf-8?B?UGF1bCBCdXp6YSwgb2xkc3RlciB1c2luZyBuZXcg | last post by:
I recently implemented error processing on my .net website, where I send myself an email from global.asax on an application error. In the last two days I have gotten a "The file '/detail.aspx' does not exits" type error--with two different file names. In both cases, I searched my entire source for the '/detail.aspx' reference and it doesn't exist. What could be causing this error? Text of error email I sent to myself follows.... ...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.