|
Is there a way by which I can redirect a request from my IIS to some page on another IIS without letting the client know about it?
I have implemented an ISAPI filter on my IIS, which scans incoming traffic and redirects all coldfusion page requests (.cfm) to www.codeproject.com
The way I went about it is as follows:
1)Create a new ISAPI project using vc++ 6.0/MFC
2)Overload CRedirectorFilter::OnPreprocHeaders(..) - it scans for .cfm requests, and sets a flag.
3)Overload CRedirectorFilter::OnSendRawData(..) - it checks the flag set above and sends a HTTP 302 response back to the client:
DWORD CRedirectorFilter::OnSendRawData(CHttpFilterContext* pCtxt,
PHTTP_FILTER_RAW_DATA pRawData)
{
// if we get a .cfm request, redirect it.
if (bRedirect)
{
char chHeader[] = "HTTP/1.0 302 Redirect\r\nContent-Type: \
text/html\r\nLocation: http://www.codeproject.com\r\n\r\n";
DWORD dwchHeader = sizeof(chHeader);
pCtxt->WriteClient(chHeader, &dwchHeader, NULL);
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
After posting a 302 response, the client browser redirects to www.codeproject.com, and displays the URL. Is there some way we can avoid displaying the new url?
I.e. If I hit http://localhost/test.cfm, the browser should show the same url even after it redirects to www.codeproject.com.
Is that possible?
Thanks in advance,
Pratz
|
|
|
|
|
I am working on a VB application that use a control that I wrote 2 months ago. When I tried to recreate the .exe, about 30-minutes ago, it informed me that it could not load a control. When I tried to close VB, it asked me if I wanted to save a source/module that has not been modified in 2-weeks. That module/form is the one that needed the control. I closed without saving, restarted the system, then brought up VC++ and tried to use the ActiveX Test Container and received the following: "Failed to create control: Unspecified error".
I've tried rebuilding the control (VC++ says it registerd the control), but I still get the same message. I am the only one who has access to the control, and has it registed; even though it is on the server. (Heck! I am the only one who knows where it is at.)
Does anyone know what the <blank> is going on here?
Everything was fine an hour ago!
Signed: John R. Shaw
|
|
|
|
|
Hi,
how can I send audio raw data to the Audio Device ?
Yours sincerely,
RedDragon2kx
|
|
|
|
|
|
I want to fill in an edit box, but not in my dialog, but in a different application. How can I fill in an edit box in an another application?
And how can I push a button in a different program?
Thanks in advance!
|
|
|
|
|
You can use SendMessage . Maybe this[^] can help you.
<italic>Work hard, Work effectively.
|
|
|
|
|
Alright I got the following code from on here to be able to notify when a registry key has been modified. The only problem is, I can't figure out how to implement this code into the DLL that I'm creating that will be used in an IE deskband. The problem I'm running into is that if I make it sychronous it will noticebly hang in IE while it waits for the Reg Key to change. Any ideas wouldn't be helpful.
#include <tchar.h>
#include <windows.h>
INT WINAPI
_tWinMain (
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
INT nCmdShow
)
{
LONG l = 0L;
HKEY hKey = {0};
l = RegOpenKeyEx (
HKEY_CURRENT_USER,
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"),
0,
KEY_NOTIFY,
&hKey );
if(l == ERROR_SUCCESS)
{
// The following call will wait until a change is made to the registry key.
l = RegNotifyChangeKeyValue (
hKey,
FALSE,
REG_NOTIFY_CHANGE_LAST_SET,
NULL,
FALSE );
MessageBox(NULL, _T("Registry key changed"), _T("Registry key changed"), 0);
RegCloseKey(hKey);
}
return 0;
}
|
|
|
|
|
try putting that bit of code in a seperate thread, using the CreateThread function. Call create thread from the entry point.
|
|
|
|
|
So you are saying I should call create thread from where I load the DLL file? And this will in turn always be activated, thus responding everytime the said regirsty key is changed. I'm alittle new at programming C++, sorry. Appreciate the help.
|
|
|
|
|
yes thats exactly wot i mean. but don't create it in DllMain. create it in the function in your dll that is called.
goto msdn.com and familiarise urself with creating thread, cos thats one of the things c++ does best, and is always useful.
|
|
|
|
|
Using DAO and MFC, I loaded an Excel file into CByteArray and then send it off to a field (defined as an "Ole Object" type in an Access 2000 database file) to the same CByteArray. When open the MS Access 2000 file the Ole Object field contains "Long Binary Data". How can view that Excel Ole Object document directly in Acesss 2000? I know that if you Insert the Ole Object manually in Access you are able to double click on the field and Excel would open that Ole Object. Please advise
|
|
|
|
|
I have a dialog based application which runs fine on NT and 2000. However, it doesnt work under XP. I have done some traces, the application gets invoked, but the main dialog window does not appear. Any ideas?
Man Learns from History that he never learns from History
|
|
|
|
|
I used ::LoadImage to load an icon on an owner-drawn button.
On XP only, if the user changes the windows color scheme to "High Contrast#1"
then then images that use the color black are hard to see.
Can I peg the background color of a button so no matter what the user does the image remains unchanged?
thanks
|
|
|
|
|
Check out the LR_LOADMAP3DCOLORS flag for LoadImage. It will change the following colours RGB(128,128,128), RGB(192,192,192), and RGB(223,223,223) to the current system colours COLOR_3DSHADOW, COLOR_3DFACE, and COLOR_3DLIGHT respectively.
You'll need to do this whenever your applications receives WMW_SYSCOLORCHANGE too.
PeterRitchie.com
|
|
|
|
|
Thank you. The WMW_SysColorChange information was very helpful.
|
|
|
|
|
hi
i have created an mfc application and in that i have one dialog box on which i set the bitmap to whole dialog box and i have three buutons on that but when i execute it doesn't show the buttons.
but when i click on that area where button was it dispalys.
I know it is the problem of painting and i tried to solve but not getting the solution.
looking forward for the reply
Best Regards
jhon
|
|
|
|
|
Are your buttons 'inside' a tab control (or another control)? If yes it's possible that the tab control is upper than your buttons thus it will be drawn 'over'. Try to use the BringWindowToTop function for your buttons
Hope this helps
|
|
|
|
|
Anonymous wrote:
i set the bitmap to whole dialog box
By removing the bitmap, do the buttons appear and work? If so, then you know the problem is related to how the bitmap is being drawn.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am trying to write a wrapper dll for a third party dll. I have previously written a simple application that interacts with the third party dll, and it works fine, but when I put the same code in the dll, it won't load the third party dll.
JNIEXPORT jboolean JNICALL Java_brp_integration_xor_XorBaseJ_initialize(JNIEnv *env, jobject obj, jstring path) {<br />
const char* pathStr = env->GetStringUTFChars(path, false); <br />
HINSTANCE LoadMe = LoadLibrary(pathStr);
env->ReleaseStringUTFChars(path, pathStr);<br />
<br />
<br />
if (LoadMe == 0)<br />
return false; <br />
...code that will never be reached<br />
Has anyone got any suggestions? I have checked pathStr, and it's value is correct.
|
|
|
|
|
What does GetLastError() return right after the LoadLibrary call?
PeterRitchie.com
|
|
|
|
|
It returns ERROR_MOD_NOT_FOUND, which feels a bit embarrasing. The path to the dll is correct though. I have checked it several times. It is possible to load a library that is not in the application's working directory or in a system directory, rigth? Is there any way to see which module is messing with me?
|
|
|
|
|
Hello,
I was wondering, is there a way to determine if a pointer points to data on the heap or on the stack?
I know that you can see if the pointer points 'near' the value of the ESP register, but thats not what I'm looking for...
I also got the blogging virus..[^]
|
|
|
|
|
I remember something about all heap memory having a certain bit set (high bit, bit 6, bit 7?), but I do not remember which it one, or if it is even really true.
Tip: if you are trying to figure out delete this functionality, be careful...!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Thanks for your reply!
James R. Twine wrote:
Tip: if you are trying to figure out delete this functionality, be careful...!
This is exactly what I'm trying to do. I alreay implemented the "feature" but it the cost was to disable all the rest for safety reasons. (copy constructor, public destructor, etc..) I want these functions to be available for flexibility, but I think that I have to make a choice...
If I could get the upper bound and the lower boud of the heap address range, than I just could....
I also got the blogging virus..[^]
|
|
|
|
|
These functions may help : GetProcessHeaps() then a HeapWalk()/HeapValidate(). In case of debug build _CrtIsValidHeapPointer.
suhredayan There is no spoon.
|
|
|
|