.Net Application Variables bleeding across applications - c#

I have a couple of websites that have a shared code base as they are essentially the same website, except one is for the UK market and the other is for the US market. As well as sharing a code base, they also share a database with a very basic CMS so that each website can have some different content.
On the sites we have an admin page which can be used to set some HttpContext.Current.Application variables for each website, things that don't change all that often, but that we may want to change at a moments notice without having to update config files etc.
Now this has been working fine for a number of years now on a server 2003 box with IIS 6. Just yesterday we upgraded to a shiny new Server 2012 box with IIS 8 and we are now having issues with the Application objects.
To cut a long story short, now when an application variable is set on one website, it is being set across both sites, so the UK market sees the US application objects and vice versa, depending on which one was set last.
The application objects are pulled from a database based on a market code, and that is all working fine (the code hasn't changed in at least a couple of years now), and I have written some logging to confirm that the correct objects are being loaded for each website.
Each website has its own application pool, so I really can't see how this is happening. I have tested the sites on Server 2008 with IIS 7.5 and they behave fine there, similarly, I run a Windows 8 dev machine with IIS 8 with what I think is an identical setup to the new live servers (the app pools are configured the same and everything) and both sites do the correct thing there.
Has anyone ever heard of this sort of issue before, and does anyone have any suggestions for things I can look into to fix this? I thought it wasn't even possible to share Application objects across separate applications, are my assumptions wrong there?
Many thanks!
Mark

This sounds like a configuration problem, are you sure those site have different market codes? Looks like the queries returns wrong values for the application objects.

Ok, so it turns out, it was a configuration issue, not with the websites or even IIS. It in fact turned out that our sysadmin, when changing the DNS for the websites, accidentally changed the US website to the UK IP address, so both sites were the same application after all. I'm afraid it never even occurred to me to ping the sites to check the IP addresses, and we all now feel suitably silly for not spotting it sooner. I can only put it down to a ridiculously early start in the morning to do the change over, resulting in a bunch of over tired developers on a wild goose chase.
Still, if anyone else has a similar issue, perhaps this will help them.

Related

Start a desktop program from MVC app using site on server n domain

I've searched for solutions for this question everywhere. They all say it's not possible. I know MVC is hosted server-side so Process.Start will affect the server and not the client.
Is there anyway I can still configure the site or the client or the servers to open a desktopprogram or file on the client when the user clicks a button?
Thanks!
Well, out of the blue, it rather hard for YOU to decide to run software on MY computer, right?
I mean, I might want to go view some cute cat pictures on your web site. However, while I am doing that, I doubt that security settings will THEN let you launch my banking applcation. Or how about you go rummage around on my computer, and grab files called passwords, or how about some files called banking information.
As you can see, the idea that since I decide to visit YOUR web site, you NOW going to start launching and running software on my computer? If this was easy, or even possible, then no sane person would EVER use the internet, since then you could at at will run software on my computer - such a possibility would make the internet oh so dangerous to use, and in fact so much so, that no one with a functional brain would ever risk using the internet again, would they?
So, as long as you are 100% clear that you searching for a way to launch and run software on my computer - such as accounting systems, banking systems, and that I would be insane enough to adopt a browser setup in which YOU can run any old software on MY computer?
No problem at all - but you want to at least be trained from the school of abused farm animals as to what you asking for here.
Note that you might be able to convince the users of that web site to eliminate or turn off any browser security, but then all of those users would indeed have a very vulnerable setup, and the resulting security issues would no doubt be deemed un-acceptable to any IT department.

completed web application, reinstalled operating system now can't connect to database

I was learning more about ASP.NET MVC, and I decided to to take a course on Udemy taught by Mosh Hamedani, and this course involved me making an application called Vidley. I was able to complete the course entirely, however I came across a problem:
A day or two after I completed the course. My computer caught a virus and I had to reformat the operating system and reinstall everything. I had the application backed up on bit bucket, but the application just doesn't work with the database. When ever I try to create a new user, the application just throws an error. What do I need to do to get the application working with the database again. I tried looking at other topics but I couldn't see anything that covered my specific issue. I am thinking if there is any kind of configuration I need to fix with the database, but I am not entirely sure and I am concerned I will break the code.
It really is upsetting because I was going to add that project to my portfolio, so I could find a job easier. I am wondering what I have to do to get this web application to work with the database again, and where should I deploy it. Should I use a website like app harbor, or is there any other better platform. I am really new at this so I am sorry if I am asking an absurd question.
Please recheck your connection string as you have reinstalled everything even the operating system.
Check your Database server instance is running or not. If not, start that service.
Recheck database name, username and password in your connection string.

What would be the best way to generate website from db

We have a lot of red tape to handle before any changes to anything can be made on our servers. Hence I'm looking for ideas and/or suggestions for the below situation.
Must generate html from db (MSSql Server) for a static website hosted on IIS 6/7.
No (external) changes should be necessary on the server side except the ones the application/website makes itself.
I tried markdown and it generates everything nicely but I could not find a way to make the above idea applicable with it. I am willing to put all html code in the db for each individual page but it sounds awkward. Should I go with something ASP.NET'ish or a Windows Service or a standalone app to run at a schedule.
Thanks for the suggestions.
ASP.NET Dynamic Data might be your technology of choice.
http://msdn.microsoft.com/en-us/library/vstudio/ee845452%28v=vs.100%29.aspx
However, my advice is that you'll never be able to solve your problems by something like the above. You need to work out how to do releases more often - maybe start with a CI server and start scripting your releases if you haven't already.

Securing Desktop Application by adding logic to WebService

I recently launched my desktop application and it got cracked after a few days. I posted a question on stack overflow and people said that i cannot stop that. In the start of the software i cannot allow this to happen and i want a solution. So, following is what i am thinking.
Currently, I have desktop application that communicates with the web server to verify the user. Once the user is verified it saves the values in Registry. The hacker has bypassed the communication code and added fake values in registry and he can use my software now.
Now, i am planning to take some of my code from MAIN features of the software to a WEB SERVICE hosted somewhere else on a web server. Whenever the software needs to run that feature the software will give a call to the WEB SERVICE with the values in REGISTRY. I will verify those values and return the results. But if the values will not match my database then i will reject the call.
So, my questions is:
1- Do you think this solution is feasible ?
2- According to my thinking, it will make the software useless to the hacker. What do you think ?
3- Any flaws in this solution ?
You don't have to get cracked. Jeez, everybody thinks there's no solutions available to prevent piracy, but there are. Disclaimer: I work for a company (Wibu Systems) that prevents software piracy and provides license management solutions.
Here's the thing: this (like all security issues) is a highly specialized area of focus and the crackers are smarter at this than you are. They are already familiar with the different home-grown solutions people roll themselves and can crack those quickly.
Commercial solutions (ours is CodeMeter; in all fairness other companies make good solutions too like SafeNet and KeyLoc) rely on strong encryption with multiple layers of protection against key discovery. These companies have spent years developing, improving, and testing their solutions; it's unlikely you will be able to come close to the robustness and quality of such a solution on your own. I can almost guarantee you that any solution you create on your own will get cracked very quickly, unless your product is uninteresting to the crackers.
I'm not trying to create an ad here; I just want to set the record straight. Companies that traditionally got cracked constantly who switched to CodeMeter stopped getting cracked. Check out Propellerhead's Record product for a good example.

How risky is the development in SharePoint 2010?

I'm trying to evaluate SharePoint 2010. I've bought the book "SharePoint 2010 as a Development Platform" from Apress to help me get started with SharePoint (I have C# and ASP.net knowledge)
In the first pages I saw this warning:
'We strongly recommend setting up a virtual server on a physical machine, such as Hyper-V or VMware on Windows Server 2008. [...] SharePoint projects occasionally crash the server during heavy development. Re-creating a virtual machine is much easier than losing your whole personal computer'
which begs the question: How dangerous / risky is SharePoint development? How can I crash the whole server with it?
I have never had to rebuild a machine because of SharePoint. BUT, I can understand the book's claim. The scenario I see is that SharePoint starts acting unexplainably bizarre, and there is no logical course of action to fix it. For example you try everything you can think of, and for some reason everyone gets a 404 to the site, even administrators. If you dig hard enough you find it was because a .resx file wasn't copied during a deployment or something. If you don't dig hard enough, you will be tempted to rebuild the entire machine for the reason of "something happened with permissions probably".
For this reason, I do keep my SharePoint environments in a virtual machine. It comes down to the fact that SharePoint can stop working and it's too difficult to figure out why. If I could enumerate the concrete reasons for this, I would say:
SharePoint's error handling is so bad and misleading.
SharePoint is influenced by every nook & cranny of the system, for example obscure group policy settings, regional settings, etc.
SharePoint is driven largely by "best practices" mentality, and has its own way of doing everything. Some things are still controlled by IIS settings, other settings must be done through SharePoint administration. If you do it wrong, you will just get crazy behavior, not a hint in the right direction. Because SP is so configuration-focused, juggling all these configuration settings is overwhelming. [edit] In other words, SP configuration is not intuitive. Getting SP to do what you want is a matter of following some official recommended practice, not following intuition. In an industry that only thrives because of developers' ability to adapt, improvise, and learn-as-you-go, SP feels more like system administration than software engineering.
Doing things in SharePoint like configuring / deploying can often take a LOT of time, and this can seriously interrupt the problem-solving flow. The amount of time it takes to just haphazardly try something can prevent me from trying things, and cause disorganization in my thought process.
Installing and configuring SharePoint is quite a task. So if anything goes wrong with SharePoint it will take long to reinstall it from scratch. But if you are using Virtual Machine you can install and configure a VM and take its backup. Now when anything goes wrong with your working VM simply delete it and create a new one by copying files from backup of your fresh installation.
Also depends on whether you want to do other things on your dev machine. I do pure .NET development on my dev machine and when I'm doing SharePoint dev I spin up a virtual machine.
SharePoint uses loads of resources and can easily slow a server right down. It can become a pain always having to stop all the services.

Categories

Resources