Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
8.8 KiB

  1. <%@ Page Language='C#' Inherits='UDDI.Web.UddiPage' %>
  2. <%@ Register TagPrefix='uddi' Namespace='UDDI.Web' Assembly='uddi.web' %>
  3. <%@ Register Tagprefix='uddi' Tagname='Header' Src='controls/header.ascx' %>
  4. <%@ Register Tagprefix='uddi' Tagname='Footer' Src='controls/footer.ascx' %>
  5. <%@ Register Tagprefix='uddi' Tagname='BreadCrumb' Src='controls/breadcrumb.ascx' %>
  6. <%@ Import Namespace='System.Data.SqlClient' %>
  7. <%@ Import Namespace='UDDI' %>
  8. <script language='C#' runat='server'>
  9. protected bool allowRetry = false;
  10. protected bool frames;
  11. protected string root;
  12. void Page_Init( object source, EventArgs eventArgs )
  13. {
  14. try
  15. {
  16. frames = ( "true" == Request[ "frames" ] );
  17. root = ( "/" == Request.ApplicationPath ) ? "" : Request.ApplicationPath;
  18. string html = "";
  19. //
  20. // Grab the exception from the current context, then clear
  21. // the error so ASP.NET won't try to throw it's own error
  22. // page.
  23. //
  24. Exception e = (Exception)Session[ "exception" ];
  25. if( null == e )
  26. {
  27. e = new UDDIException(
  28. ErrorType.E_fatalError,
  29. "UDDI_ERROR_FATALERROR_UNKNOWN" );
  30. }
  31. else if( null != e.InnerException )
  32. {
  33. if( e.InnerException is SqlException && ((SqlException)e.InnerException).Number >= 50000 )
  34. {
  35. SqlException se = (SqlException)e.InnerException;
  36. e = new UDDIException(
  37. (ErrorType)( se.Number - 50000 ),
  38. "UDDI_ERROR_SQL_EXCEPTION",
  39. se.Message
  40. );
  41. }
  42. else if( e.InnerException is UDDIException )
  43. e = e.InnerException;
  44. }
  45. //
  46. // Determine whether we should be showing the stack.
  47. // SECURITY: Should we be doing a Debug.VerifySetting on Debug.StackTrace?
  48. //
  49. bool showStack = false;
  50. try
  51. {
  52. if( 1 == Config.GetInt( "Debug.StackTrace", UDDI.Constants.Debug.StackTrace ) )
  53. showStack = true;
  54. }
  55. catch( Exception )
  56. {
  57. }
  58. //
  59. // Try to provide more detailed information on the source of the
  60. // exception. If we don't know the exception type, we'll simply
  61. // output the exception message.
  62. //
  63. if( e is UDDIException )
  64. {
  65. UDDIException ue = (UDDIException)e;
  66. html +=
  67. "<b>" +
  68. String.Format(
  69. Localization.GetString( "TAG_ERROR" ),
  70. "</b>" + ue.Number.ToString() + " (" + (int)ue.Number + ")<b>" ) +
  71. "</b><br><br>" ;
  72. breadcrumb.AddBlurb( ue.Number.ToString() + " (" + (int)ue.Number + ")", null, null, null, false );
  73. switch( ue.Number )
  74. {
  75. case ErrorType.E_accountLimitExceeded:
  76. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_ACCOUNT_LIMIT_EXCEEDED" ) + "</p>";
  77. break;
  78. case ErrorType.E_busy:
  79. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_BUSY" ) + "</p>";
  80. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_CONTACT_SYSTEM_ADMINISTRATOR" ) + "</p>";
  81. allowRetry = true;
  82. break;
  83. case ErrorType.E_categorizationNotAllowed:
  84. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_CATEGORIZATION_NOT_ALLOWED" ) + "</p>";
  85. break;
  86. case ErrorType.E_fatalError:
  87. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_FATAL_ERROR" ) + "</p>";
  88. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_CONTACT_SYSTEM_ADMINISTRATOR" ) + "</p>";
  89. allowRetry = true;
  90. break;
  91. case ErrorType.E_invalidKeyPassed:
  92. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_INVALID_KEY_PASSED" ) + "</p>";
  93. break;
  94. case ErrorType.E_invalidCategory:
  95. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_INVALID_CATEGORY" ) + "</p>";
  96. break;
  97. case ErrorType.E_keyRetired:
  98. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_KEY_RETIRED" ) + "</p>";
  99. break;
  100. case ErrorType.E_languageError:
  101. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_LANGUAGE_ERROR" ) + "</p>";
  102. break;
  103. case ErrorType.E_nameTooLong:
  104. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_NAME_TOO_LONG" ) + "</p>";
  105. break;
  106. case ErrorType.E_operatorMismatch:
  107. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_OPERATOR_MISMATCH" ) + "</p>";
  108. break;
  109. case ErrorType.E_userMismatch:
  110. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_USER_MISMATCH" ) + "</p>";
  111. break;
  112. default:
  113. break;
  114. }
  115. }
  116. else if( null != e )
  117. {
  118. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_FATAL_ERROR" ) + "</p>";
  119. html += "<p style='width: 400px'>" + Localization.GetString( "ERROR_CONTACT_SYSTEM_ADMINISTRATOR" ) + "</p>";
  120. }
  121. //
  122. // BUG: 2351
  123. //
  124. html += GetFormatedErrorString( e, showStack );
  125. //
  126. // BUG: 2351
  127. // Removed the following code and replaced it with logic to display
  128. // dynamicly visible error strings.
  129. //
  130. /*
  131. // Display a stack trace, if requested.
  132. //
  133. if( null != e && showStack )
  134. {
  135. string trace = e.ToString();
  136. trace = trace.Replace( "\r\n", "<br>" );
  137. trace = trace.Replace( " ", "&nbsp;&nbsp;" );
  138. html += "<p><b>" + Localization.GetString( "TAG_STACK_TRACE" ) + "</b><br>" + trace + "</p>";
  139. }
  140. */
  141. errText.Text = html;
  142. retry.Visible = allowRetry;
  143. }
  144. catch( Exception e )
  145. {
  146. errText.Text = "<p style='width: 400px'>" + Localization.GetString( "ERROR_FATAL_ERROR" ) + "</p>";
  147. errText.Text += "<p style='width: 400px'>" + Localization.GetString( "ERROR_CONTACT_SYSTEM_ADMINISTRATOR" ) + "</p>";
  148. }
  149. }
  150. private string GetFormatedErrorString( Exception e, bool showstack )
  151. {
  152. string s = "";
  153. if( null != e )
  154. {
  155. string msg = "";
  156. if( e is UDDIException )
  157. msg = ( (UDDIException) e ).GetMessage( UDDITextContext.UI );
  158. else
  159. msg = e.Message;
  160. s += "<p><a onclick='expandError()' style='cursor:hand;font-weight:bold;'>"+Localization.GetString( "TAB_DETAILS" )+"</a><br>";
  161. if( showstack )
  162. {
  163. s += "<div id='ErrorDetails' class='boxed'><b>" + Localization.GetString( "TAG_STACK_TRACE" ) + "</b><br><span >" + e.ToString().Replace( "\n","<br>" ).Replace( " ", "&nbsp;&nbsp;" ) + "</span></div>";
  164. }
  165. else
  166. {
  167. s += "<div id='ErrorDetails' class='boxed'><span >" + msg +"</span></div>";
  168. }
  169. s+= "</p>";
  170. }
  171. return s;
  172. }
  173. </script>
  174. <uddi:StyleSheetControl
  175. Runat='server'
  176. Default='../stylesheets/uddi.css'
  177. Downlevel='../stylesheets/uddidl.css'
  178. />
  179. <uddi:PageStyleControl
  180. Runat='server'
  181. OnClientContextMenu='Document_OnContextMenu()'
  182. />
  183. <uddi:ClientScriptRegister
  184. Runat='server'
  185. Source='../client.js'
  186. Language='javascript'
  187. />
  188. <uddi:SecurityControl
  189. Runat='server'
  190. />
  191. <form enctype='multipart/form-data' Runat='server'>
  192. <script>
  193. function expandError( )
  194. {
  195. var elt = GetElementById( "ErrorDetails" );
  196. if( document.getElementById )
  197. {
  198. //
  199. // Render IE5+
  200. //
  201. if( elt.style.display == "none" )
  202. elt.style.display = "block";
  203. else
  204. elt.style.display = "none";
  205. }
  206. else if( document.all )
  207. {
  208. //
  209. // Render IE4
  210. //
  211. if( elt.style.display == "none" )
  212. elt.style.display = "block";
  213. else
  214. elt.style.display = "none";
  215. }
  216. else if( document.layers )
  217. {
  218. //
  219. // Render NS 4+
  220. //
  221. if( elt.style.visiblity == "hidden" )
  222. elt.style.visiblity = "visible";
  223. else
  224. elt.style.visibility = "hidden";
  225. }
  226. else
  227. {
  228. //
  229. // Unsupported Browser Type.
  230. //
  231. }
  232. }
  233. </script>
  234. <table width='100%' border='0' height='100%' cellpadding='0' cellspacing='0' >
  235. <asp:PlaceHolder
  236. Id='HeaderBag'
  237. Runat='server'
  238. >
  239. <tr height='95'>
  240. <td>
  241. <!-- Header Control Here -->
  242. <uddi:Header
  243. Runat='server'
  244. />
  245. </td>
  246. </tr>
  247. </asp:PlaceHolder>
  248. <tr height='100%' valign='top'>
  249. <td>
  250. <uddi:BreadCrumb
  251. Id='breadcrumb'
  252. Runat='server'
  253. />
  254. <table cellpadding='0' cellspacing='0' width='100%' border='0' style='table-layout: fixed' class='helpBlock'>
  255. <tr>
  256. <td colspan='2' style='padding: 15px'>
  257. <h1><uddi:StringResource Name='HEADING_ERROR_PROCESSING_REQUEST' Runat='server' /></h1>
  258. <asp:Label ID='errText' CssClass='normal' Runat='server' />
  259. <script>/*Close the error on load.*/expandError();</script>
  260. <asp:PlaceHolder ID='retry' Runat='server'>
  261. <!-- Removed Retry Feature. -->
  262. </asp:PlaceHolder>
  263. </td>
  264. </tr>
  265. </table>
  266. </td>
  267. </tr>
  268. <asp:PlaceHolder
  269. Id='FooterBag'
  270. Runat='server'
  271. >
  272. <tr height='95'>
  273. <td>
  274. <!-- Footer Control Here -->
  275. <uddi:Footer
  276. Runat='server'
  277. />
  278. </td>
  279. </tr>
  280. </asp:PlaceHolder>
  281. </table>
  282. </form>