Comments

   Next >
daniel
"Code in another assembly" section was really helpful for my projects.
Thanks for sharing !
Øyvind
Worked like a charm. Needed the same for the min function, but it was easy to fix given your example.

Thanks a lot.
lenardg
Alex, are you sure you have included jquery.validate.js (or the .min version) and jquery.validate.unobtrusive.js (or the .min version)? Before you use the code I showed in the article?

In the newer ASP.NET MVC project templates, these files are not included in the _Layouts.cshtml (for Razor) file. Instead, they are referenced from individual .cshtml files when you generate an editor template (or something that required validation)?

If you use the default generated way, you need to add the code in my article AFTER those includes.
lenardg
Jannik, automatic properties have been around since C# 3.0 (.NET 3.0). I did not really point out which version of the code was written for. If you are using an earlier version of the .NET Framework (1.1 or 2.0), you will need to define a backing field for the property as follows:

private int _processorAffinity;

public int ProcessorAffinity
{
   get { return this._processorAffinity; }
   set { this._processorAffinity = value; }
}

Alex
This does not work for me :-(

Get a browser error:
Uncaught TypeError: Cannot read property 'methods' of undefined

Any idea?
Jannik
what about the

public int ProcessorAffinity { get; set; }

must declare a body because it is not marked abstract or extern
It works!

Thanks ;)
Russel
Thank You Very Very Much!!! I was dying for this....
Excellent Solution...Worked without a glitch !!
sandeep sharma
Hi lenardg ,
I apply the same modification in all places but my service raising an exception thats see below
project Namespace: wcfService1
Interfacce : IRebuildallService
Class : RebuildallService

when i run the my wcfservice it rais this error
if i add the service reference and discover the URI then also not service is listed.please help me on this

Well my service name was service1 earlier and i renamed it after that hope this will help to u to find the solution easily.

Server Error in '/' Application.
--------------------------------------------------------------------------------

The type 'WcfService1.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The type 'WcfService1.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

Darren Mart
Great article, thank you. I'm still getting the hang of MVC3 and will hopefully leverage this article when I try to serve up partial views from a separate assembly.

My only suggestion is to tweak FileExistsInZip() so that it's not case-sensitive. The Views should really be found whether one goes to /TestZipped or /testzipped, took me a few minutes to realize why the latter wasn't returning the views.
Nikolay Popov
Hi Lenard,
I share your views and agree with your points, as .NET dev I'll (I may) be happy with the move to WP7, but as Nokia C7 user (Symbian ^3 device) I certainly am not happy. For me the reason for the move is money ( a lot of MSFT's). In the same time Symbian devices will continue to come to Europe for shore, as opposed to USA, so I don’t really care much, as I live in Europe – I’m Bulgarian. There is something also notable in this regard – have you seen the speed and quantity of presenting new Symbian ^3 devices, it’s so huge these days and this makes me thinking that Nokia really goes on internal Plan B, where they continue to develop new features for Symbian, which is great . I hope that they’ll do the same with MeeGo too, which from what I’ve seen and read for N9 is also great. There are no reasons to trough the baby with the water, I can’t see a reason to trough away an OS, in which you have invested may be hundreds of man years! And by the way Symbian ^3 is great – I really don’t see something missing in it in comparison to Android and iOS ( it’s true that I can compare only with Android personally - I have one, but no iOS device)
I wish Microsoft to open the doors for QT development on WP7 , although they don’t allow native apps, may be they can allow Nokia ones. This can bring a whole lot of good apps in WP7.
We’ll see :)
Best regards, Nikolay
KOT
Try:

http://www.nirsoft.net/dot_net_tools/gac_viewer.html
Very usefull thanks
Fran L
Awesome!
It works, thanks Lenard.
James
Hey Lenard,
Sorry to use your blog comment system to contact you. But I have no way to email or PM you on NotebookReview site.
I saw your post about "Anyone want Spotify invites?" and I would like to get one if possible.
Thank you. and please delete this post from your blog, no matter i can get invite or not.

from another .net developer (nice blog btw) - James
Andrej
Have you thought about extending the code to render partial views?
Sergey
I see my problem.
My local IIS site - http://localhost/ZippedVirtualPathProvider
and that is why virtualPath looks like "~/ZippedVirtualPathProvider/Views/TestZipped/Complex.cshtml"
instead of "~/Views/TestZipped/Complex.cshtml"

Thanks for your response. Great article.

lenardg
@Sergey, have to look into that. I think it might be just a configuration thing. Which version of IIS are you trying to get this to work with?

@Marco Leo, I am not sure you can remap the location of the web.config file, especially since it contains vital information for IIS as well (if you are using IIS7 or later). While I have not confirmed this, I think that you cannot remap web.config. Have to do some digging to make sure.
Sergey
It seems that it doesn't work with IIS, however everything is fine with WebDev server. Do you have any thoughts what could be wrong? Thanks.
Daniel Carvalho Melo
Sensational!

I´m from Brazil and I searched for this kind of solution during a entire day!
I researched for Custom Binding, change the .js manually, change the Decimal fields to String and populate the Decimal on the property´s setter...
I did´t found a globalization version for this js library, so, I think this is the best solution.

At line 4 of the range validation, I suggest another change to solve validation when using "." to thousand separator:
----------
var globalizedValue = value.replace(".", "").replace(",", ".");
----------

And with we associate this with a mask, we have a nice masked and validated number and currency validation:
http://www.jquerypriceformat.com/

Thank you.




Rene
Hi thanks a lot for the article but in my app is not working I am using jQuery Validation Plugin 1.8.0

Do you know how to solve it in this case?
Marco Leo
hello @Lenardg, I found your post really interesting and I tried to implement a similar version but in my case I just wanted to Load views from another File system location outside the web-app, without zips.

Everything works almost fine :), I am having same problem with the web-config of the view. Now my application want to get the web-config in the virtual path under the web-app root instead of my Virtual path remapped root. And for same reason it can't resolve same css files too.

I hope you can help me and future people with the same problem.

Thank again for your post i found it really useful.

Marco Leo

elperucho
Thanks brother
I had two days with the error of the blessed coma.

lol that is the problems of Latin countries. ;-)
lenardg
@Tom, glad you found my post useful. I think it possible to serve views from wherever you want them to be, be it ZIP files, databases or assemblies. Although assemblies might be tricky, because they are also loaded by ASP.NET, but before loading they are copied over to the temporary asp.net files folder. I myself have not tried your approach, so I do not know if there could be some sideeffects there.

But I think your problem might be in the override of GetCacheDependency(). My implementation checks if the file was served from the .ZIP file, and then it creates the cache dependency itself, specifying the .ZIP file as the object to monitor.

I think you should there specify the .DLL file (assembly) you pulled the view out of. From the error you are getting I think you are calling the base implementation, which tries to monitor your view and fails - of course, since the view itself does not exist on disk.
Tom
Thank you for your post. Your approach is exactly what I'm looking for, however, I would like the virtual views to reside in a different assembly. I have a "core" assembly that gets re-used across projects. I would love to be able to put re-usable views in the "core" assembly, then use your approach to pull the views when needed. I've tweaked your process to look for views in an assembly, but it fails. I keep getting the following error:

Directory 'C:\ProjectStore\xxx\xxx\xxx.Admin\Views\Person' does not exist. Failed to start monitoring file changes.

Is it possible to pull views from a different assembly? My goal is to have a single location for re-usable views.

Thanks agian for your post and insight.
   Next >