(1) make sure The Remote Debugging Monitor (Msvsmon.exe) is installed on the server,
(2) if not, you can share your local Msvsmon.exe on "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger" folder, and run it from the remote server
(3) make sure dll and pdb files are the same on both local and server ( copy from local if doubt)
(4) attach process from vs, use default transport (not remote transport), and type server name (not ip address), make sure it attach to "managed code" (not "native code")
(5) attach to process w3wp.exe, if multiple process of w3wp.exe exist, use this tool (systemroot\system32\iisapp.vbs) to find out which process match your application pool
(6) put a break point on local and open browser to request server page
(7) debugging ...
Tuesday, October 21, 2008
Thursday, April 10, 2008
warning user when leaving page without submitting it
There are many cases that user leaves a page intended or accidently and of-course all the changes he made won't be saved. In these cases user has to go back and re-make his change, and it causes frustrations, therefore it's not the best user experience we want to provide in our web applications. Luckly, the solution is pretty simple and it could save user's time and also enhance our web applications' usability.
When user leaves the page, we can show an confirmation javascript window, if user click "No", he will stay on the page. This works on every links on the page, the back button and even the close window action can be canceled. The key part of this solution is tie "window.onbeforeunload" event with a javascript function. The following function shows how to emit the javascript function from asp.net code behind.
However, this confirmation message will show up even the page postback to itself, such as user click button to sumbit or a dropdown list auto postback. So we need a way to prevent these control's events from showing the confirmation message. Following function will do the trick. Note that we treat control differently, if it's dropdown we use "onChange", otherwise we use "onClick".
When user leaves the page, we can show an confirmation javascript window, if user click "No", he will stay on the page. This works on every links on the page, the back button and even the close window action can be canceled. The key part of this solution is tie "window.onbeforeunload" event with a javascript function. The following function shows how to emit the javascript function from asp.net code behind.
protected void EmitJsConfirm()
{
string jScript = String.Empty;
if(!Page.IsClientScriptBlockRegistered("jsConfirm"))
{
jScript = String.Format(@"<SCRIPT language='javascript'>var needToConfirm = true;function confirmExit()
{{if (needToConfirm){{return '{0}';}}}}
window.onbeforeunload = confirmExit;</SCRIPT>",_jsConfirmMsg);
Page.RegisterClientScriptBlock("jsConfirm",jScript);
}
}
However, this confirmation message will show up even the page postback to itself, such as user click button to sumbit or a dropdown list auto postback. So we need a way to prevent these control's events from showing the confirmation message. Following function will do the trick. Note that we treat control differently, if it's dropdown we use "onChange", otherwise we use "onClick".
protected void ExcludeControlFromConfirm(params WebControl[] controls)
{
foreach(WebControl c in controls)
{
if(c is DropDownList)
c.Attributes.Add("onChange","needToConfirm = false;");
else
c.Attributes.Add("onClick","needToConfirm = false;");
}
}
Thursday, January 31, 2008
Prameter in web service is not LOCAL
for functions if you keep the name as the same, all passed by value parameters should be like local variables. therefore you can change its name without affecting outside calls for this function. but it's not the case for web service, for example if you have an old web method
void ReturnContent(bool Secure)
and you changed it to void ReturnContent(bool IsSecure) , then it won't work as expected, and the web method will always default the value "IsSecure" to false since it failed to get the node from the soap message.
void ReturnContent(bool Secure)
and you changed it to void ReturnContent(bool IsSecure) , then it won't work as expected, and the web method will always default the value "IsSecure" to false since it failed to get the
Subscribe to:
Posts (Atom)