Cannot access image site(IIS) directly - asp.net

I am talking about IIS and ASP.NET application. Currently I decide to create one web application in one site (http://domain.com) and another one site for keeping images (http://images.domain.com). After a little work, I found the problem of accessing the path for creating the images from web application site to image site. One solution that is appeared on my thought is using Web Service. But I still want to hear if there are other solution for solving this problem from you guys?

A few options, most of them applicable if both sites are on the same computer, or even on the same network domain :
Give the windows user that acts as the identity of the main site's application pool, access permissions to the Images' site folder.
use Impersonation to access the other images' site folders with the right permissions.
Another option is to have both sites run as the same windows user
other then that, haveing a web service to push files to the Images site is a great and scalable solution.

Related

Making SharePoint folder accessible over internet

I have a SharePoint document library on my intranet and I want o make this library accessible to users on internet. I know easier option is to just make the website internet facing but that is not possible for some reasons.
To workaround the thing I was thinking to map this document library to a folder on another server on intranet and make it a virtual directory; this server is internet facing and so the virtual directory can be accessed by the users.
Just wondering have any one got a better option or see any issues with this said approach?
Thank you!
You can extend the web application and essentially create an extranet web application that still require permissions. Then you can grant the external users access to either the site or that document library with unique permissions. Might be overkill but that could do it.

Is it secure to put all of your ASP.NET web apps under the same website in IIS (e.g. Default Website)? (more inside)

I am going to need to host multiple websites in IIS, but will not have separate URLs setup in DNS for each one. Because of this, I will not be able to use the Aias/CNAME functionality in IIS to redirect traffic to individual Websites in IIS.
Would it be secure enough to publish all of my web apps to the same Website in IIS?
Example: under Default Website, there is a folder for each individual web app:
-Default Website
--[folder for webapp1]
--[folder for webapp2]
--[folder for webapp3]
URLs used to access each web app:
www.mydomain.com/webapp1
www.mydomain.com/webapp2
www.mydomain.com/webapp3
Is this sort of setup secure or a good idea (best practices)? It seems like a simple solution to the problem of not having a separate domain name in DNS for every web app (website).
What do you think?
I don't see any issue with that approach, in a way it does simplify things quite a bit actually.
Sites being secure is not going to be affected by this. Of course each application would be under it's own pool, it's always a great idea to run like this.
This being said, your main website is going to run under it's own application pool and if there is a problem with it all your applications will be affected. That's the one thing I would pay extra attention to so you might want to not actually use that top level app pool for anything.

Difference between creating my asp.net MVC web application ,under the IIS Default web site, or create it as a new web site

I have published my asp.net MVC web application under the “Default web site” inside IIS. I actually added two versions of my web application:-
one directly under the default website and it can be accessed by typing http://servername
one under presaging path , and can be accessed by typing http://servername/prestaging
so I got confused on which approach it is recommend to add my asp.net web application, and what is the difference between adding my web application under the default web site, or creating a whole new web site ?
Thanks
This has more to do with organization within your company's IIS structure than right and wrong. If the site you built truly is the only site on the server, putting it on the Default site is not looked down upon.
But if the application is a sub application of the default site, the latter approach is the more appropriate approach if you only get to access the site from the //servername URL.
If you have a separate domain, myapp.servername.com, you can install it into the default iis site and add a binding or you could create a whole separate web site.
Has more to do with your structure than right or wrong.
Edit
To answer your comment, creating the site under the default web site will make the URL in most cases be: 'http://myservername/MyApp'. Creating your own application would require (in most cases) a separate binding address, 'http://myapp.myservername.com' It is really only affecting the URL you place in your browser and nothing else. More complicated setups are possible, but for most cases, these are your two options.

Two web applications on a single domain

A client has a business application installed on their local server, with a database of their customers. I have to implement an application (web or win) which will query the database and send mails to customers based on certain rules.
However, one of the requirements is that a mail should have a link allowing their customers to confirm or cancel certain appointments, and the problem is that my client wants to have these links having the same domain as their web site, which is already hosted somewhere else.
The way I see it, the only way to do this is for them to allow me to access their existing site, and add the necessary functionality there directly, but they are no too happy about it.
Is it possible to add a separate application to that same hosting provider, which would sit in the same domain?
Or do you have a better idea?
You could use subdomains or use a subdirectory and make it an application in IIS.
1) Subdomain
Add a new website in IIS and add binding to a subdomain. So lets say their main website is www.company.com you will add binding yourwebapplication.company.com
2) in IIS select the website, right click and choose: Add Application
The website does not have to be fysically in a subfolder, it can be anywhere as long as you have the rights set correctly.
You can use an IIS Virtual Directory for this.
Create a Virtual Directory (IIS 7)

ASP.NET MVC 3 - Images not found if deploy as application on IIS 7.5

I have an ASP.NET MVC 3 website which is running on http://localhost/. I also have a new project (ASP.NET MVC3) and I want to deploy it as application
so the url will look like http://localhost/child/
But I have problems with images. If I create image using <img src="/content/img/site-logo.png" alt="logo" />
the image is not available, because the actual URL should be /child/content/img/site-logo.png.
I can solve it if I put url in Url.Content("~/content/img/site-logo.png")
but I don't want to change all my images now.
Is it some more easy solution? Some IIS 7 settings?
I had the same issue, but I found the reason why it was forcing authentication on the Contents folder.
When a user is not logged in yet, they are classified as Anonymous Authentication. In IIS7 (which is what I am using, guessing it is the same in IIS6) you need to open the authentication window in features view. Then edit the Anonymous Authentication, to use your application pool identity, or the default one, just make sure that user has permissions to read in that folder.
That fixed it for me, hope it works for you.
I can solve it if I put url in
Url.Content("~/content/img/site-logo.png") but I don't want to change
all my images now.
I am not aware of any IIS setting, other than of course setting your application to run at the root of the IIS web site.
You should always use url helpers when dealing with urls in an ASP.NET MVC application. So you really should change all hardcoded urls, and by the way this doesn't include only images, it could be also anchor hrefs, form actions, hardcoded urls in your javascript files, ...
You can create virtual directory in root iis project and point it on directory with images. BUT, you should better spend this time to clean up your image paths because it, probably, will bite you in future again.

Resources