Runtime error Cannot use a leading .. to exit above the top directory - vb.net

Exception thrown: 'System.Web.HttpException' in System.Web.dll
Additional information: Cannot use a leading .. to exit above the top directory.
I'm getting this error when trying to access a property of a control.
$('#<%= cboDenialReason.ClientID %>').change(function () {
showHideOtherDesc(this.value);
Note that the combox box is a Global.System.Web.UI.WebControls.DropDownList.
Not sure why it happens here, as I'm not making reference to my files?

Related

How to fail Velocity template processing with tracable message

Having:
Velocity template or macro
some object
How to validate the object (#if) and fail (stop further processing) in a way that is easily tracable to the place of failure (like throwing exception in Java).
I am looking for something like this:
#if ( ! $context.treasureMap.containsKey('gold'))
#fail('no golden treasure here')
#end
Background
I am writing a maven site page. The velocity context is injected by maven and contains POM information. I want to test existence of some information from effective pom. When the information is not available, I want to fail.
Requirements
fail Velocity processing > fail site generation > fail maven build.
error message should lead to the place of failure so the site should be fixed
preferably no configuration (no extensions, just constructs/tools contained in plain Velocity)
Tried
Strict Reference Mode
Unwanted configuration, do not want to fail on every occasion.
#evaluate('#end') aka syntax error
(Chose #end as most descriptive to my intent) Basically what I want. Fails the processing and maven build but the error message does not lead back to failure location:
ParseException: Encountered "#end" at line 1, column 1..
You need to make a method call which produce exception.See explanation:
The only place where one could run into trouble within Velocity is if there is a call to a method which throws an exception during runtime. For example, this VTL defines a String $foo and then attempts to call its substring() method on it would throw an IndexOutOfBoundsException:
#set ($foo = "bar")
#set ($bar = $foo.substring(0,10))
When the exception is thrown, the parser will stop processing and throw that exception up the stack tree where it can be caught in the method that caused the parser to execute. At that point, the exception can be handled gracefully.

DBNull error - 'System.InvalidCastException'

Using Visual Studio 2008 and generating .net 2.0 framework with VB.net for a web application.
I encountered a very strange problem currently. After I build a solution and click a link in a web page, I got an error message as following. The same thing happened when I tried to run in debug mode.
*************************************** ERROR Message ******************************************************
"An exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll but was not handled in user code"
"Additional information: Operator '=' is not defined for type 'DBNull' and string "". "
*******************************************************************************************************************
The problem part is simply as below in a vb file. The value of dataview(0)(“name”) is NULL and my_name is a variable string. The strange is thing I didn't change any code in this vb file. This vb file was built previously and used for a long time ago without any problem. It just suddenly happened today. I have this syntax all over the program without causing any problem. I have tried to restore the whole solution back to original but still have the problem.
Can anyone please advise why all the sudden and how to fix?
If dataview(0)(“name”) = my_name then …
Try to determine NULL value first ..
If NOT IsDBNull(dataview(0)(“name”)) Then
If dataview(0)(“name”) = my_name then
'codes here
End If
End If

VB.Net "COMException was unhandled" Error

I have a VB.Net program written with .Net 2.0
I'm trying to write a code that logs entire registry entries into a log file.
I have got it to work wit the following code.
http://pastebin.com/kmA63cUe
However whenever I try to add an additional Registry key to log
LogPrint4("<-----------------HKLM/WebCheck-------------------->")
If reg.enumvalues(&H8000002, "Software\Microsoft\Windows\CurrentVersion\WebCheck", keys2, types) = 0 Then
If IsArray(keys2) Then
For p = 0 To UBound(keys2)
reg.getstringvalue(&H8000002, "Software\Microsoft\Windows\CurrentVersion\WebCheck", keys2(p), value)
LogPrint4(keys2(p) & "=" & value)
Next
End If
End If
It comes up with the following error
COMException was unhandled Check the ErrorCode Property of the
exception to determine the HRESULT returned by the COM object.
I'm not sure why it is limiting it only to 5 checks.
Anyone have any ideas?
Consider using the built-in Registry support instead of the COM libraries. At a minimum, you'll get clearer error messages. It is supported in .NET 2.0.
http://msdn.microsoft.com/en-us/library/microsoft.win32.registry(v=vs.80).aspx
Good luck!

Vb2012 admin permission

I have coded up a cleaner type of program but getting a huge error with permissions ( I think )
The error message is printed out like so.
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path 'C:\Windows\CSC\v2.0.6' is denied.
And it says that the error part of the code is this line
For Each fi In DirectroyInfos.GetFiles(filter)
But here is the fill block of code.
For Each fi In DirectroyInfos.GetFiles(filter)
Try
file_count = file_count + 1
file_size = CULng(file_size + fi.Length)
FilesToDelete.Add(fi.FullName)
Catch ex As UnauthorizedAccessException
'There's really no pretty way to handle this exception
Catch ex As FileNotFoundException
'There's really no pretty way to handle this exception
End Try
I think it's some sort of permission problem I have windows 7 and have noticed there are a lot of run has admin problems.. I think its trying to remove or gain access to a file which it does not have permission to get .
Is there anyway to fix this? Am I missing something in my coding?
As you said in your question, you don't have write access that file.
Either skip files you don't have access to, or run the application as admin.
There appears to be a limitiation with the win32 api that will skip all files in the folder if you do not have access to one of them.
Check out this solution from Microsoft Connect:
How to: Iterate Through a Directory Tree (C# Programming Guide)

exception when finishing a custom "new file wizard" in a RCP project

I am working with a custom "new file wizard". when i press the finish button i am expecting the eclipse to add a new file and show it correctly, but instead an exception occurs and i can't open the created file. But if i use this wizard for a second time, the exception doesn't occur and the file opens correctly. why?
the exception occurs when this line getContainer().run(true, false, op) executes.
and it is a part of the exception:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-07-28 16:15:01.239
!MESSAGE Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor' from bundle '33'
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalArgumentException: can't find IDfind.ext
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:857)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:837)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:889)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:623)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:725)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:696)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:690)
.
.
.
So the problem is that one of plugins that you have in your app requires a marker named find.ext. The error log shows IDfind.ext because the error message is concatenated without a space.
The happens if you have a custom application. Solution is quite easy:
Locate your WindowActionBarAdvisor that extends ActionBarAdvisor and defines your application initial menus and toolbars like File, Help, etc. etc.
Add this line:
menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
f.e. to the method
createEditMenu.
or to any other menu entry.