Applying Patch to Asp.Net MVC website - asp.net-mvc

Creating a patch utility that will update my current website with my patch. when user login to its system and there is an update available it will prompt to user and if user accept it it will update its system. I want to know when this process starts i want the website to stop fulfilling request from other users until the files are copied so there is no malfunctioning occurs. I want to know what will be the best approach to take the website down although user is logged in to the same website and many other will try to access it? Im using Asp.Net MVC 2. I hope that my question is clear to all

There is a built in method to take an asp.net application offline. Here is a link describing what to do
http://www.15seconds.com/issue/061207.htm
Hope the gets you started.
Bob

Related

How can i make my MVC application insider capable

I have a project and i want my ASP.Net to be able to have same capabilities like windows insider. For example i want to give some of the users the new features and functionality to test same like share point allows to deploy new feature to some of the users. Is there any platform available that i can use or i will have to modify my application to have this capability?
E.g. the Sharepoint today has this capability that we can select some users and then provide them access to have new feature and version or outlook allows you to see new features but user has capability to turn it of.
There is one strategy:
You can do something like request forwarding.
You can install another web application with new features.
Then when user comes to your site you can ask them whether they want to see old application / new application.
If they select new, then on server side, you can redirect user to new web setup.
Once you aware that most of the people are going to new web tier, you can then shutdown old servers.
Obviously there will be other factors, like
is this only UI level change or you have some data store and that is
also going to change.
If it requires change in underlying database, then how are you going
to make sure that new application gets data from old database
You will have to think through and decide strategy best applicable for your solution.
I know this does not provide direct solution to your question, but this should given enough information on your question so that you can get started with some approach.
One option is to use an Authorize Attribute on a new controller defined for the new feature and add users who you want to have access to a role.
For example you could put users A, B and C into the Role "CanUseNewFeature" and just put a conditional if on the view something like:
#if(User.IsInRole("CanUseNewFeature")
<a href="yourlink" /> Check out new feature! </a>
and the controller
[Authorise(Roles ="CanUseNewFeature")]
public class NewFeatureController : Controller

Making a facebook notification system

I am working on asp.net mvc 5 project, i really need healp on how to make a notification system just like facebook (whnever a user posted a record the orher users will be notified) any healp?
Have a look on this. It might help you
http://www.encodedna.com/jquery/create-a-facebook-like-notifications-using-jquery-css.htm
But the solution provided is only for front-end, you need to tune your database structure to create alerts based on the user interaction with the website

How do can I create web pages on the fly from an iOS app?

Context/Background: I have an iOS app with a Firebase backend. Each user on the app has a couple of public stories or journals. I am working on the v2 of the app and one of the main features of v2 is to give users the ability to publish their stories as static webpages by a click of a button. The goal is to have a journal for a user with a username "johnhouse", for example, be available at www.the-app-domain.com/johnhouse.
Question: How do can I create web pages on the fly from an iOS app? Im not sure where to start. Which online services should I look at?
I thought of spinning up a server and hosting www.the-app-domain.com on it, getting the app to ssh into the server and creating a directory called "johnhouse" (from the example above) inside the website's root directory and then pasting an index.html file inside it, But this doesn't only sound like a bad idea, it also sounds complicated as hell If I were to generate the html files on the app, how would I get them to the server? how would I get them into the right location?
There are a great many ways you might implement this behavior but I'll suggest one.
Consider what this product might look like if the app had no knowledge of how these static pages were published. All the app needs to be able to do is allow users to set which of their stories are published or not and to inform those users of the url at which their published stories will be available.
There may be real advantages to removing the app from your page-creation process.
If you find that you need to make change to the formatting of your pages you can do so without requiring an app update and you can choose if you want to rebuild every page or just have changes apply to new pages. This might be important if you discover that your pages don't render well on some devices or are not indexed the way you would like by search engines.
If you need to change where your pages are hosted you can do so (and provide redirects from the old location) without needing everyone to update to a new app version.
If you need to add moderation or curation of the content you publish you can do so more easily than if clients (your app) have direct control of your site content. This may be important when someone starts publishing SEO spam links to your site, or registers the username admin or login, or publishes a story containing malicious javascript, or publishes content which gets you a copyright infringement notice.
You don't need to give clients direct access to your web server which could allow them to edit each other's content or overwrite your site with their own malicious content.
Since you're already using Firebase take a look at how you might run your own web server as another client of this backend. One which looks for "published" stories (however you identify those in your data model) and generates appropriate pages for them. Depending on the tools you elect to use these could be dynamically generated pages (client side js or a web app) or static pages build by some backend process periodically or whenever stories change and added to a web server. Without any idea what server side tools would be most appropriate for you it's hard to know what specifically to suggest here.

Prompting for credentials on saving data

I am developing an ASP.Net MVC4 app that uses windows authentication. One of the requirements of the app is to prompt for credentials when an item is edited, even though the app is already aware of the user's credentials (User.Identity.Name). This requirement is necessary to meet FDA software validation standards.
I read I can do Response.StatusCode = 401 and that will force a login prompt, but I am not aware of a way to capture that information so I can save it with the data. I also read doing this has other side-affects.
Would I have to use a mix of forms and windows authentication? If so, does anyone know of examples that might help me get started? Like I said, I have to capture the user credentials so I can save it with the data.
The basic purpose of the prompt is to ensure that the person editing the data is who they say they are. For instance, I can walk away from my computer with the app still open and someone else can come along and change data in my name. Hope that makes sense.
Thanks.
Anything dealing with reauthorization will need to be customized for your specific needs.
My recommendation would be to open a (client-side) modal with username/password, and pass that information along with the rest of your POST data. Obviously you will need to have a fallback for <noscript>, if that's a requirement as well.

Integrating twitter,facebook and other services in one single site

I need to develop an application which should help me in getting all the status,messages from different servers like Twitter,facebook etc in my application and also when i post a message it should gets updated in all the services. I am using authlogic for authentication. Can anyone suggest me what gems/plug-ins i can use..
I need API help to get all the tweets/messages to be displayed in my application and also ways to post the messages to the corresponding services by posting it from my application. Can anyone help me from design point.
Walk through what you'd want to do in your head. Imagine the working site, imagine your webapp working before you start. So your user logs in (handled by authlogic) and sees a textbox called "What are you doing right now?". The user fills in a status message and clicks "post". The status message appears at the top of their previously posted messages.
Start with the easy part. Create a class that posts to two services. Use the twitter gem and rfacebook to post to two already defined services. In the future, you'll want to let the user associate services to their account and you would iterate through the associated services and post the message to each. Once you have this working, you can refactor or polish the UI a bit to round out this feature. I personally would do the "add a social media account to my profile" feature towards the end.
Harder is the reading of the data (strangely enough) because you're going to have to figure out how to store it. You could store nothing but I suspect you'd run into API limits just searching all the time (could design around this). I would keep a little cache of posts associated to the user's social media account. In this way, the data model would look like this:
A user has many social media accounts.
A social media account has many posts. (cache)
Of course, now you need to schedule the caching of the posts. This could be done manually, based on an event (like when they login) or time based. So when the update happens, you load up the posts for that social media account and the user will see the posts the next time they hit the page. For real-time push to the client's browser while they stare at the screen, use faye (non-trivial) and ajax to pull the new posts to the top of the social media stream view.
The time based one is tricky because you'd either have to have a cron job run or have rails handle it all with a gem like clockwork. But then you have to leave rails running. I've also solved this by having a class in /lib do all the work and a simple web call kicks off the update. But it wasn't in a multi-user use case. So that might not work. In any case, you'll want to have some nice reusable code for these problems since update requests can come from many different sources.
You'll also have to deal with the API limits. When pulling down content from twitter, you won't get everything. That will just have to be known by the user or you'll have to indicate a "break in time" somehow.
The UI should be pretty easy (functionally anyway), because you know which source the post/content is coming from. It'd be easy to throw a little icon next to the post to display which social media site it's coming from.
Anyway, good luck, sounds like a fun project.

Resources