In the click event of a form button i have VB "Response.Redirect(url string)" It is really quite simple. The string i pass is what i described in my initial posting, it is a complete "http://" string. It appears that ASP.NET and/or the IIS server is disregarding the "http://" part and assuming that i am making a relative reference and so adds the redirect url to the server root url, as i describe in my initial post. I tried doing workaround by calling a html web form and use javascript to automatically submit it and the form submit creates the same url corruption. Funny thing about this, this redirect url corruption only occurs when calling different web applications that are in the same domain, such as "http://server1/application1" and "http://server1/application2". If i call a web application on "http://server2/" instead of "http://server1/" i do not experience this. As i mentioned, the corruption does not occur all the time, but frequently enough to be a major issue. So far i have found no solution or workaround. I may have to contact Microsoft technical support on this one.
redfish34
Posts
-
Response.Redirect corrupting redirect URL -
Response.Redirect corrupting redirect URLI am trying to Response.Redirect to another web application but ASP.NET keeps corrupting the URL. Example, if i am at "http://localhost/application1/main.aspx" and i do redirect to "http://localhost/application2/default.aspx" the redirected url will become "http://localhost/http://localhost/application2/default.aspx". It is as if ASP.NET is guessing that i am redirecting using partial URL, but i am not. How does one fix this?
-
Appending Multiple RTF FIles Together for PrintoutIn a mail merge task i am doing, it is desired to have one large file that holds all the merged documents for easy printout. Is there a quick and dirty way to append RTF files together? Thanks.
-
Download File From Website With LoginYes, i have done search of the internet. I got code examples for downloading files using credentials. In order to download the file in my problem, user has to login to website using a POST webform, then go to webpage with link on it, then download link. One cannot go to webpage direct as webpage will not show download link without login cookie. One cannot go to download link directly as link changes name and so one must parse HTML for it first. My problem is that after i do POST to the login page and get login cookies back, i cannot seem to use these cookies to retrieve the desired webpage. I keep getting the webpage version shown to users not logged in (which does not contain the download link). Since i am new at this, i am not sure what i am doing wrong.
-
Download File From Website With LoginI am attempting to automate the downloading of a file from a website that requires user login. At this point i want to get clarification of the steps i need to follow to accomplish this. Currently i am doing the following (in pseudo code) without success: --Make POST HttpWebRequest/HttpWebResponse of "Login.php" that posts login username and password; --Get response cookie collection and put into CookieContainer variable; --Make HttpWebRequest/HttpWebResponse of "Content.php"; assign CookieContainer variable to request; --Get GetResponseStream of response and put HTML content into String; --Parse HTML content for download link; --Download link to disk; --Process downloaded file.... With this code, the HTML retrieved from Content.php is for a webpage shown to users that have not loged on and so the download link is not shown. Below is test code for the above. // ################################################################## public void TEST() { // login // forms authenticate string loginUri = AppGlobal.LoginUrl; string requestString = "username=" + AppGlobal.UserName + "&password=" + AppGlobal.Password + "&autologin=checked"; byte[] requestData = Encoding.UTF8.GetBytes(requestString); HttpWebRequest request = null; Stream stream = null; HttpWebResponse response = null; // set up request _cookies = new CookieContainer(); request = (HttpWebRequest)WebRequest.Create(loginUri); request.Proxy = null; request.CookieContainer = _cookies; request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = requestData.Length; // make form post stream = request.GetRequestStream(); stream.Write(requestData, 0, requestData.Length); // get response response = (HttpWebResponse)request.GetResponse(); // update cookies foreach (Cookie returnCookie in response.Cookies) { // debug help Debug.WriteLine("COOKIE: " + returnCookie.Name + " = " + returnCookie.Value); // compare new cookie with stored cookie // update cookie container bool cookieFound = false; foreach (Cookie oldCookie in _cookies.GetCookies(new Uri(AppGlobal.CookieUrl))) { if (returnCookie.Name == oldCookie.Name) { oldCookie.Value = returnCookie.Value; cookieFound = true; } } if (cookieFound == false) { _cookies.Add(new Uri(AppGlobal.CookieUrl), returnCookie); } } // get webpage request = (HttpWebRequest)WebRequest.Create(new Uri(AppGlobal.Start
-
ArrayList Resetting When Adding Form ControlsBelow is test code to replicate the problem. I trying to add form controls to an ArrayList. In LinkButton1_Click, two textbox controls are added to ArrayList. No problem. But when i break this code into two separate LinkButtons, only one textbox will ever be added to ArrayList when both link buttons are clicked. The last textbox added will overwrite the first one added. The ArrayList.Add should not behave like this. What is going on? How should i make this work? To store they control i am using an ArrayList. public partial class Builder_Generator : System.Web.UI.Page { ArrayList _controls = new ArrayList(); TextBox _textBox = null; protected void LinkButton1_Click(object sender, EventArgs e) { _textBox = new TextBox(); _textBox.Text = "first"; _textBox.ID = "first_Textbox"; Form_PlaceHolder.Controls.Add(_textBox); _textBox = new TextBox(); _textBox.Text = "second"; _textBox.ID = "second_Textbox"; Form_PlaceHolder.Controls.Add(_textBox); } protected void LinkButton2_Click(object sender, EventArgs e) { _textBox = new TextBox(); _textBox.Text = "first"; _textBox.ID = "first_Textbox"; _controls.Add(_textBox); } protected void LinkButton3_Click(object sender, EventArgs e) { _textBox = new TextBox(); _textBox.Text = "second"; _textBox.ID = "second_Textbox"; _controls.Add(_textBox); } }
-
So Many ADO Data Providers Which Should I Use?Sorry, i forgot about all the non-english speakers on this forum. KISS stands for Keep It Simple. I am not a programmer who always reaches for the latest technology to solve a problem because often the technologies are not mature and have many undocumented problems. I learned that ADO from VB6 is supported in NET for backward compatibility. That was confusing me. I now understand that OleDb is the choice to use for NET.
-
So Many ADO Data Providers Which Should I Use?I am coming from VB6. I looked up NET database examples for MS Access and find there are several ways to do the same thing. I saw one example use a OleDb provider, one used a ADO provider, and one used a SqlClient. My quesiton is- what should i be learning? Which should i use? What do most programmers use? My program philosophy is KISS. I think OleDb provides generic access? But i am not sure. Some advice from experienced programmers would be helpful.
-
Wait Cursor with Timer?For a treeview i would like to change the mouse cursor to an hour glass after a delay when selected tree nodes take a long time to populate. I was able to do this in VB6 using a timer event, where a busy flag is set and then the timer event checks flag to determine if cursor should be changed to an hour glass. When i try to do similar in C# the cursor does not change. I am able to change the cursor in the code populating the node, but that causes flickering becasue the hourglass is shown even when selected nodes do not take long to populate. Am i dealing with some kind of multi thread issue here? What is the normal solution?
-
Trying to Put HWND Value Into String [modified]I found the answer. You folks have really played the tempting devil with your MFC code, but i am going to restrict my learning to ANSI C++/STL. I plan to develop on Linux/Mac too. The following code works. char buffer [100]; sprintf(buffer, "%I64d \n", (unsigned __int64) hwnd); OutputDebugString(buffer); The reason i want the HWND in a string is so i can dump debug info to troubleshoot a problem. It seems that the hardest part of C++ is finding the information! By luck i found the answer on the internet. I had no clue that sprintf was to be used for this. I come from VB6/C# background and so these non-orthodox language commands throw me off. Once i learn the C++ quirks things will become straight forward.
-
Trying to Put HWND Value Into String [modified]I am restricting my learning to ANSI for now. I canot believe how hard it is to convert a number into a string in C++. ltoa will only convert a long into a string, not HWND. I have searched on the internet and did not find a single code snippet to convert HWND into a string. Certainly programmers print out HWNDs in order to debug their code!? How does one convert HWND into string un ANSI C++?
-
Trying to Put HWND Value Into String [modified]I am a beginner. I have read some tutorials and newbie books on C++ but am having trouble doing things beyond the basics. I am trying to display the HWND when i use certain Win32 functions such as GetForegroundWindow() for debugging purposes. When i use Win32 MessageBox or OutputDebugString such as below... 1) m_foreHwnd1 = GetForegroundWindow(); MessageBox(NULL, (LPCSTR)m_foreHwnd1, "INFO", MB_OK); 2) OutputDebugString("ForeHwnd1: "); OutputDebugString((LPCSTR)m_foreHwnd1); OutputDebugString("\n"); ... I get errors like the following: First-chance exception at 0x77e26673 in SendFocusWin.exe: 0xC0000005: Access violation reading location 0x00090548. Unhandled exception at 0x77e26673 in SendFocusWin.exe: 0xC0000005: Access violation reading location 0x00090548. I am not getting anywhere and am starting to get fustrated. What are the code steps i need to take to get the HWND value safely AND put it into a string variable that i can use elswhere in my code? What would be the ANSI solution?
-
Trying to Display HWND as StringI think i posted on the wrong forum. I now see that there is a forum that supports STL questions, which i think would help come up with a ANSI version of the solution you folks provided. Sorry. But thanks for the excellent response!
-
Trying to Display HWND as StringI am a beginner. I am trying to display the HWND when i use certain Win32 functions such as GetForegroundWindow() for debugging purposes. When i use MessageBox or OutputDebugString such as below... m_foreHwnd1 = GetForegroundWindow(); MessageBox(NULL, (LPCSTR)m_foreHwnd1, "INFO", MB_OK); OutputDebugString("ForeHwnd1: "); OutputDebugString((LPCSTR)m_foreHwnd1); OutputDebugString("\n"); ... I get errors like the following: First-chance exception at 0x77e26673 in SendFocusWin.exe: 0xC0000005: Access violation reading location 0x00090548. Unhandled exception at 0x77e26673 in SendFocusWin.exe: 0xC0000005: Access violation reading location 0x00090548. Can i display the HWND so i can see what the heck is going on in my code? What is the How To?
-
Advice Troubleshooting Memory Leaks Using PInvokeI have made an application in C# that uses a lot of PInvokes to the Win32 that create shared memory using VirtualAllocEx and more. I have a pretty bad memory leak now. Surprise! I have no experience dealing with this problem. What is the best way to find memory leaks in NET? Or do i simply try random things and cross my fingers?
-
The Noob of Noob QuestionsI am a C# programmer, using VS 2003. I found C++ DLL code on the internet and created a new C++ project to clean up the code to modern standards. When i compile the new project i am getting hundreds of errors. It appears nothing is recognized by the compiler. When i put the cleaned up code in the original project, replacing the original files, eveything works fine. So i concluded that certain project settings needed to be configured. So i go back to my new project and try to make the project settings the same. But when i compile i still get hundreds of errors. What do i need to set up to have compile success? Why does C++ have to be so hard to use?
-
Multiple Icons in Icon FileThanks. Too bad it does not support 32-bit icons. It pops up a warning when 32-bit icons are opened.
-
ApplicationContext and Windows ShutdownI am making a tray application with a custom ApplicationContext. Application exits OK when i close application manually. When i try to close application by doing Shutdown windows, windows aborts shutdown. I realize my problem is because application is not cleaning up. What do i need to do so that my application will exit OK when a user chooses to Shutdown windows instead of closing manually? I am at a loss where to put clean up code. :(
-
Fast Forms - Tricks of the Trade PLEASEI am desparately trying to get my apps forms to load acceptably fast before release to users. I thought C# was suppose to be comparable to C++ in speed? It seems more like VB6 is a better comparison! I wish i knew the real deal before starting this project! I was lulled into a false sense of security when i kept reading about miracles on the internet about dramatic increases in performance with little tweaks. I thought a solution would come along sooner or later. I am developing in NET 1.1. My computer is 1GHz Sony Laptop Windows 2K. Description of my forms: Combination of custom controls, forms, and user controls. By using panels and user controls as subforms, forms are up to 3 levels deep. Form have about 10-30 controls each on them. Controls used are stock labels, buttons, checkboxes, radio buttons, textboxes. Some forms have customized listviews and combos inherited from stock controls. All forms have button icons. What i have done: I have used the double buffering control style with AllPaintingInWmPaint and UserPaint in the forms, user controls and custom controls where i could. Code is in the constructor. I am using SuspendLayout, ResumeLayout to wrap control setup code that is outside the InitializeComponent method. It is called either in the constructor or Form Load. I tried precompiling assemblies. No performance gain there. Double buffering slowed form load down but improved the sluggish drawing. Sluggish drawing persists. To describe, drawing of forms seems to be done in pieces, not all at once. Overall, the perception of loading has improved a notch, BUT NO MORE THAN A NOTCH! :( I will note that once the form loads the first time, future access during program excution is fast. It seems form graphics are cached by the CLR. But that first time loading! Ouch! What can i do?
-
Multiple Icons in Icon FileThis is for a freeware application. I am using the Nullsoft Installer and trying to customize it. I have to make an icon file with a number of icons in it that match a specification. Three of the icons required have to have 16 Million colors. This is a problem. I use VS 2003 to create the icon file. VS 2003 only supports icons up to 256 colors. I know of no other tool that can make an icon file with multiple icons. How do i do this?