In dotnet core 6 service (class library) I am accessing HttpContextAccessor.HttpContext.GetRouteData() but it says it does not contains definition for GetRouteData.
Any help on this.
Thanks.
GetRouteData() is an extension method in namespace Microsoft.AspNetCore.Routing.
You have to add using Microsoft.AspNetCore.Routing;
Related
Microsoft website says there is a IHttpControllerFactory which can be used to generate controllers in custom ways.
However, the System.Web.Http DLL referenced from Visual Studio:
packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll
Doesn't have that interface:
So where is the interface now?
It's gone and replaced by a dependency resolver or more specifically the IDependencyResolver interface. Once you write your own dependency resolve you could plug it into the Web API:
config.DependencyResolver = new MyDependencyResolver();
Cannot find it as well.
Anyway you can use IHttpControllerActivator to create your custom controller factories in Web API.
I'm using the .NET 4 framework, and I have a static class with static functions in an asp.net web application.
I have a second class library project. The class library project wants to call the static method in the web application. Intellisense works, but then the compiler reports that
"The name [MyClassName] does not exist in the current context".
Can I make this call, or this not allowed?
PS, the static class is in the /App_Code folder.
Thanks!
Is it not possible to refactor the class out of the web project? Referencing a web project from a class library sounds awkward. If your class does not contain web-specific code then you could pop it into that other class library you mention or create a new one. Should it reference web-specific libraries something like MyProject.MyLib.Web could do the trick.
You need to add a reference to the project containing the class you want to access.
You need to ensure that you are using the full name of the class (including the namespace).
Alternatively add a using directive with the namespace to your code file.
If your target framework is .Net Framework 4.0 Client Profile change it to .NET Framework 4 and rebuild the solution.
I am using spring2.5. and trying to implement a custom CommonsMultipartResolver for ajax upload.
After I submited form, I got following error:
org.springframework.web.util.NestedServletExceptio n: Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.multipart.commons.CommonsF ileUploadSupport$MultipartParsingResult.getMultipa rtFiles()Lorg/springframework/util/MultiValueMap;
It seems that I need class org.springframework.util.MultiValueMap. But I can not find it anywhere in spring2.5.
Can you tell me which jar contains it?
thanks
It supposed to be in org.springframework.core...jar file, but such class does not exist in Spring 2.5
http://static.springsource.org/spring/docs/2.5.0/api/org/springframework/util/package-summary.html
It was added only in Spring 3.0.x
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/util/package-tree.html
I think you may be mixing versions of spring jars, since the 2.5 version returns a regular Map as parameters to the getMultiPartFiles() method (javadoc). The 3.0.x version uses MultiValueMap (javadoc).
It's not the map type that is missing, but the method. Check that you are using spring-web version that matches the rest of your spring dependencies.
I'm creating a DNN 4.9.5 module and need to create a DLL from a WSDL (Doba API). I've created a separate Class Library project in my DNN solution with Class1.vb in it. What do I need to include in my class from the WSDL file? Obviously, I won't be going with Class1.vb, but just need a gentle push as to how to get this going.
Thanks much for your guidance.
This is not a problem. Simply create your class library and then use "Add Service Reference" to point to the WSDL.
Do not use "Add Web Reference" unless you have to. Microsoft considers that to be "legacy technology".
Why do you want to create a dll to access the webservice? If you just want to use it (assumung that you are using ms-visualStudio) you need to add a webservice reference to your separate Class Library project .
That will create the sourcecode for a wrapper class to call the webservice described by wsdl.
See msdn:How to: Add and Remove Web References
I am trying to write a method for a Compact Framework 2.0 dll which will return the name of the parent application from which the dll is called but I am struggling to see how to do this.
Using reflection I am able to get the dll I have written etc - any ideas how to get the application name?
Thanks
Morris
You can use
AppDomain.CurrentDomain.FriendlyName
And if you want the full path to the EXE:
Assembly.GetCallingAssembly().GetName().CodeBase