Studying MVC 4 MySQL Mono and need suggestions on authentication - c#

I'm currently studying how to deploy and run a full pledged ASP.Net MVC 4 site on Mono. Now, please don't get me wrong, I'm doing my best to do research on how to implement this. My first option was OAuth, but after some research, it seems that I might have some issues running it with MySQL.
So perhaps, I'm stuck with Simple forms authentication? I've seen some samples done in 2012 online which simply reuse the old authentication from MVC 3 and replace the one generated my MVC 4 projects.
I need your advice to which step to take best.
Cheers!

Related

How can I run ASP.NET MVC within a Windows Service

I'm working on an application that requires me to host a WCF REST Web App using Windows Service. Now since it is going to be a bit more complicated than just a small API, I would like leverage MVC capabilities as a lot of things would be lot easier if done using the 'Controller' way (if I can say so). I'm don't have deep knowledge of MVC and Windows Service.
So far, I've found only two links here & here, that are somewhat related to what I want, but still not there. Could anyone please point me to a working example or create a small demo? TIA.
Based on your comments, it is clear that you are wanting to run REST-based web-services, self-hosted, on both Linux and Windows.
The recommended way to do this is to use the new ASP.NET Core platform, running on .NET Core.
Microsoft provide a good tutorial here:
https://docs.asp.net/en/latest/tutorials/first-web-api.html
Another link just received from a quick google search Here but yes need some more clarity on how you plan to run it or what its for.
We used Nugent package manager years ago for self-hosting a web API

Creating a web service for a system built on nHibernate & stored procedures

I have been asked to build a rather simple form processor application that interacts with an already-existing system that is built on nhibernate & uses stored procedures to manage all the business logic in the system.
My goal is to build a (hopefully) simple web service (json if possible) that I will be able to access from both a web site, and ultimately an iphone & android app down the road.
I've built a couple fairly substantial RESTful api's using other technology (PHP, python, Redis, Mysql, etc) however aside from my basic understand of the overall syntax of C#, i'm pretty green to the whole ASP world. And frankly, the thought of doing anything drag and drop makes me want to stab rusty forks into my eyes ;)
My questions to those with C#/ASP/nHibernate experience:
I have visual C# express 2010 - do I need to purchase visual
studio to build this app?
Is it even possible to build a simple
JSON api/web service that can handle simple transactions (ie: return
a list of dates, and insert a single new entry) with C#? What tools do I need to get started down that path?
Does anyone have
any resources or recommendations for a crash course or high level
tutorial in C# web service construction?
I've done a fair bit of reading on nHibernate now, and feel i have a loose understanding of how the thing works, i'm just foggy on how to link a few simple classes/stored procedures with the actual web service.
My goal is to completely avoid re-inventing any wheels, and keep this thing as lean as possible... essentially, the web service is only there to pass data back and forth to the database.
Any help would be GREATLY appreciated - I know I can build this thing, I just can't seem to figure out where to start - if I could just sit down and code the thing, I would be fine... but it seems that with microsoft, you can't just sit down and code anything :S
EDIT: I'm working on Windows 7 Professional, I have downloaded nhibernate 3.2.0 and installed visual C# express 2010, I also have a windows 2008 server box with ASP.net 3.0 at my disposal for testing purposes.
EDIT 2: Which express package should I be downloading here? I have C# express, which seems to be the wrong one to start with - http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express
EDIT 3: Thanks for the answers so far... currently downloading visual web developer and will dig into WCF and MVC a bit further.
No need to purchase VS. The license for VS Express allows for commercial applications to be built with it.
Yes, you can build a simple JSON api/web service - use ASP.NET-MVC, not webforms. I have done this a few times.
http://asp.net/mvc and for a working example of an MVC web site http://nerddinner.com
For web work, VS Web Developer Express is what you should be using.

Downgrade asp.net Mvc from 3 to 2

I know this is a rather odd question, please don't flame me :)
I have a concrete need to "downgrade" a current Asp.Net Mvc 3 (net framework 4) application to Asp.Net Mvc 2 (net framework 3.5) because our shared hosting provider does not support .Net 4 (I know it's crazy considering it's been in retail since 12 Aprli 2010 and first beta came out in May 2009 but it's not the point of the post).
Is there any tool, or guide, or anything that could help in the process? I'm getting a bit lost because I upgraded many applications but I never had to downgrade one.
Besides strictly MVC, I'm using a data layer with EF Code First (maybe nhibernate will be the best tool to replace that?)
Any help, tip, info, whatever is appreciated.
Thanks.
EDIT: Changing hosting provider is not an option, otherwise I wouldn't have posted this at all. I personally am against this downgrade - I find it totally senseless - but still it's the only option.
I would change hosting provider. If your provider is not supporting .NET 4.0 now then do you really want to build a long term relationship with them? What happens the next new great feature is released, how long will they take to implement that? I don't think there's any future there if that's the kind of service they provide.
Saying that, if you have no choice but to remain with them, then I think your only option is to
Change the project's target framework setting in Visual Studio to 3.5.
Remove MVC 3 and add MVC 2
Change all Razor views to the Web Forms view engine syntax
Recompile and work through all the errors
For your web.config file I would create a new MVC 2 project and work from that web.config copying any extra settings needed from your old config.
Depending on the size of the project this is obviously going to a be a big task.
The only way I can think of is to get a machine with MVC 2 installed, get the project and try to compile it targeting .NET 3.5.
This will generate lots of errors.
Actually - this might be the way to convince those that hold the purse strings that you need to change hosting provider. You can show them the error list and put an estimate on how long it will take to fix them. If this is a long time (a couple of weeks?) then it might be more cost effective to move.
You can convert asp.net 4.0 website to asp.net 2.0 easily
Just make a new website
Then Select .net Framework 2.0
Copy the all files except web.config file from your asp.net 4.0 website folder in the new website folder
remove the unused usings from all the .vb or .cs files
Run the website easily

CRUD with MVC in win application c#

i search a lot google and found many article for CRUD operation with MVC but most of them was for asp.net. i was looking for CRUD operation code in c# with MVC in win application as a result i can see their flow and understand how they are developing their layer in MVC. if anyone know about the url from where i can have sample code for RUD with MVC for win form then please let me know. thanks
Here is a sample that I put together of one way to handle CRUD in an ASP.NET MVC application.
http://gpsnerd.codeplex.com/
In this example, the CRUD is handled by a Repository pattern. Let me know if you have any questions.
Bob
Did you check
1. Rocket Framework
Though it is not fully MVC, it is developed with n-tier pattern which seems good for any enterprise system..
Please talk to the project owner or check the code before making any commitment to use it with high volume enterprise scale systems

MVC or Webform Architecture for new site

I'm developing a website , job portal. I have 2-3 years of ASP.NET webform development experience,
I want to create a professional job portal site (to improve and learn more) but trying to decide on best architecture. Any suggestions or advice will help...
Thanks
Well, there are a number of ways to answer this question, and I'm sure many others will chime in. I'll just say that since your goal is to improve and learn more, and you already have 2-3 years of webform experience, this might be a good opportunity for you to learn MVC. Then you will have experience in both, and can make more informed decisions regarding the best architecture for future projects.
Happy learning!
Whilst nobody can tell you exactly what to do, the team I manage is about to release a new CMS / Job portal using ASP MVC. MVC gives us excellent testability and scalability out of the box and it can be quickly combined with tools such as nHibernate / windsor (IOC) / nCache / jQuery - this ensures that you have a wealth of resources on the internet to help accelerate your development and skill. You can also embrace standards such as XHTML 1.1 strict, which is almost impossible with ASP.Net webforms due to the auto generated HTML
1 other advantage is that you also get away from the dreaded ASP.Net viewstate.
Use ASP.NET MVC if you want to:
learn the ASP.NET MVC framework
use jQuery or similar libraries
really learn web-languages (HTML, CSS, JavaScript)
use Test Driven Development
have a clean separation of concerns
If you don't have the time or will to learn to use the ASP.NET MVC framework correctly, stick with ASP.NET WebForms.
My answer is almost always "ASP.NET MVC." The amount of flexibility and features and testability and maintainabilty and ... heavily outweigh WebForms.
WebForms has the advantages of a rich ecosystem of existing controls and documentation, and is really powerful for some kinds of tasks (complex, multi-form interactions), but I find its limitations get in the way far too often. You have to mold yourself to it.
It really depends on what the end goal of the application is. As Scott Ewers said, if your goal is to learn, then using ASP.NET MVC will expand your breadth of knowledge in the ASP.NET space (since you already know web forms).
Additionally, if this is going to be a public product, you can leverage the testability benefits of MVC and run automated unit tests. Key ideas like Separation of Concerns can also increase long-term scalability and maintainability.
The primary reason why you might choose web forms is if you are rapidly prototyping the job board application. As you know, web forms allows you to drag-and-drop components onto the canvas to quickly create some basic data entry functionality.
There is a herding code podcast from May 13 on the subject.
Herding Code 47: Joe Brinkman on Webforms vs ASP.NET MVC.
I also agree that choosing MVC would have the advantage of allowing you to expand your knowledge. That not being the only reason, given the choice as well I just finished a small MVC project (my first) and let me tell you MVC rocks! Its a great framework which I feel gives you more flexibility and at the same time out-of-the-box tools to create a web app quickly and painlessly. It was my first experience with VS2008 & .NET FW 3.5 & LINQ, and all the guides at www.asp.net helped me go forward quickly (especially the free tutorial chapter from an MVC 1.0 book mentioned here).
I also got to learn JQuery along the way, as it is very much integrated into these new technologies.
One think to take note though is that this being a new tech, version 2 is already being cooked up, so if your project is for the long run, have that in mind and plan accordingly (in my case, being a small project, I'll probably try upgrading my project to version 2 when its officially released). Yet at the same time, having a fully MS (and thus MSDN) supported version 1 was a godsend for me...
Good luck!
I have good experience in Jquery, CSS, HTML, Javascript but not in TDD.
I have time..and willing to learn MVC but wasn't sure MVC is good choice for Job portal or similar site..
This can be considered a shameless self-advertisement but here is my quiz on how to choose between the two:
http://sietch.net/ViewNewsItem.aspx?NewsItemID=101
I was recently tasked by one of my clients to write a paper, or simply a checklist, that would help other lead developers make this same decision.
I posted the first 2 rough drafts on my blog. I am admittedly pro-mvc but the paper/checklist has been we received so it might be helpful.
http://eric.polerecky.com/archives/a-somewhat-less-biases-comparison-of-mvp-and-mvc/[http://eric.polerecky.com/archives/a-somewhat-less-biases-comparison-of-mvp-and-mvc/][1]
I think the most often overlooked benefit of MVC is convention; I really see any convention in webforms projects and while not strictly enforced in MVC projects at least its there.
i started developing our current app in webforms, mvc wasn't available when development started.. i've chosen the MVP pattern, with URL rewrite HTTP module. currently i'm investigating plugging in some MVC into this, basically to use the front-controller instead of using page-controllers. the other things in already established MVP architecture with web forms in my app give me more flexibility than pure MVC approach without WebForms, which i like, although require a bit more code than MS MVC examples (never tried it for real project to see if it stays that way, like in those examples in screencasts).
what i don't like with MVC is mixing control code inside templates - i believe loops, ifs and stuff like that just shouldn't belong inside the template. but a couple days ago i've ran into Spark view engine that looks kind of promising in that segment, although not still close to the Tapestry 5 (a component-based webGUI framework) in the java world.
But the above mention suggestion to mix both might work for you to explore MVC world and have the safe ground to fallback to if something won't work for you might be ok for you.

Categories

Resources