HTTPModule invoked on main page but not on sub-page - windows

I am facing a strange error in MOSS 2007 running under Windows 2008. I have created a custom HTTP Module that fires on the application's OnAuthenticate event. It basically creates a custom cookie which is used by another application to authenticate the user, creating a single sign-on effect.
Everything went fine under the development server running Win2K3. However, on the staging server the following wierd things are happening:
a) The module seems to fire on the base page, i.e. https://conn.test.com/Pages/Default.aspx, however if somone goes into a sub-page directly like: https://conn.test.com/Operations/Pages/Operations%20Portal.aspx, it does not seem to fire.
b) The module gets fired from IE but not from Firefox or Chrome. The only difference between the two seems to be that a certain webpart loads and works in IE but does not seem to load or work in Chrome or FF.
Can someone help explain the behaviour of this. The HTTPMOdule overrides the AuthenticateRequest event of the application.

Sorry got this figured out. The problem is that the Init method of the event handler for OnAuthenticate works with privileges of the underlying ASP.NET user, but the main event handler delegate works with the credentials of the authenticated user.
I had written some code t log on to an Event Log and apparently this needs higher level privileges. This was the reason the module's delegate was firing but nothing was getting logged.
My guess is that the webpart on the main page ran with privileges of some other user who had the necessary access rights and hence things worked there. Since it does not work in FF or Chrome the module did not work in those browsers. Also the sub-pages do not have the webpart, hence directly going onto them, also causes the problem.
The issue got sorted after I added SPSecurity.runWithElevatedPriviliges around the logging code.

Related

chrome extension ajax call onstartup

Here's what I'm trying to achieve with my Chrome extension and the issue I'm facing:
My extension runs an ajax call every x minutes to a server and based on the result, displays the updated information in the extension pop-up window.
I was able to implement all of this logic with my ajax call made from popup.js and it works perfectly fine.
The only limitation I currently face is that the extension user has to click on the extension icon for the popup.js/html script to be triggered and executed (which is expected).
- I'm trying to figure how to trigger the ajax call function when the browser is launched.
Solution trial 1: I moved my ajax call and response logic from popup.js to background.js and included a chrome.runtime.onStartup.addListener. The problem with this approach is that background.js can't access my popup DOM and thus I cannot display my updated information.
Solution trial 2: I kept my ajax call and response logic in popup.js. In background.js, I added a chrome.runtime.sendMessage within the chrome.runtime.onStartup.addListener. The problem with this approach is that popup.js is not triggered obviously (no user click on extension icon yet) and thus apparently not able to get the message from background.js to execute the ajax call.
I'm pretty confused with what is the right approach to follow, it feels a bit like an chicken & egg problem.
Any help or feedback would be very much appreciated. Thanks in advance!
P.S: I'm using Manifest V3

Chrome Extension AJAX always caches errors

I'm working on updating an old Chrome Extension I have. It works fine if the user is already logged into Google (It's a wrapper on Google Tasks) but if the user isn't logged into Google it caches the 404 response on the AJAX and will never, for any reason, refresh it after the user logs in. Currently the only only way to make it work is to manually go to the page (just type it in the address bar) the AJAX call is trying to retrieve after which all will work fine. Reloading the extension and opening/closing Chrome will not reset it.
On the flip side, if the user begins the session logged in all is fine. When they log out the badge resets as it should but it will never reset once they log back in.
I've tried cache: false, I've tried appending a random variable to the URL. I've tried xmlHTTPRequest.abort() and everything else I can think of with no luck.
Here's the code:
https://github.com/Bit51/Better-Google-Tasks/blob/master/Src/js/utilities.js
Any thoughts?
The issue here was due to the use of "Background Scripts" instead of "Background Page." Switching to the latter allowed me to be able to reset the call.

CefSharp - How to handle "This page has insecure content." message?

I am using the CefSharp .Net wrapper for the Chromium Embedded Framework as a simple wrapper around a web application. In my web application, I make a JSONP AJAX call out to another domain to get some data and display it. The URL to that domain is not using SSL. Because of that, when doing this in the Chrome browser, I get the following message, to which the end user would simply click "Load Anyway", allowing the JSONP request to fire and the data to be retrieved...
The app using CefSharp simply starts up the main URL to my web application when it runs. When I try and make the same call in my this application using CefSharp, however, it doesn't get that same prompt. Instead, the AJAX request just times out (the same behavior that happens when the end user never clicks a button in the yellow bar that appears in Chrome).
Does anyone know if CefSharp has a way for me to catch this security message and either...
Prompt the end user to click "Load anyway", similar to the behavior of the Chrome browser, or
Programmatically bypass the security warning altogether?
If not, does the Chromium Framework itself support dealing with this situation?
After posting to CefSharp and CEF projects, it looks like CEF does not currently support this situation. magreenblatt suggested a couple of approaches to add it to CEF. Now I just need to try and find the time to add support for it. :-)

After deployment, login control stops working

In my development environment I can register and login just fine. After loging in or registering I do a redirect. Once deployed I noticed that the registering still works, but the page refreshes. Stranger still is the fact that when I try to log in, it also refreshes.
So basically, everything works - users still can register, the application can find the database, I can view public pages, etc. Just getting past the login (or register) page is not working. No redirect, just a refresh...
I run in IIS 6.0, SQL Server 2008, asp.net 4.0. I use membership and roles provided by asp.net.
Without more information, my best guess is a web.config problem. Make sure defaultUrl attribute set to your default page's name in the forms element of the web.config.

Why page_load is called twice in my web application?

I have already gone through some of the posts in many websites regarding page_load being called twice but my problem is little bit different from those.
My problem is with the landing page of my web application.
Initially in my website page_load for the landing page was getting called twice every time when it is loaded. Since my application is an upgraded one (from VS 2003 to VS 2005/2008), I commented the "this.load" event in InitializeComponent. Now it works fine, when user first logs in, into my web application. But then, whenever user navigates to this page from any other page in my application, page_load gets called twice.
Does anybody have any idea about why this could be happening. I tried to track the call stack for this, but VS 2008 was showing that this was getting called from external code.
Also, I am using frames in my web application. I wonder if this problem has anything to do with frames.
Any help is deeply appreciated.
Regards,
Hari

Resources