Issue in routing in existing ASP.NET application - c#

I have a problem with routing in an existing ASP.NET application for work. I have the code for the application and i can build and run it. When i run it I see the home page, but all links and images have invalid URL's. For each URL the same problem occurs.
For example an image on the home page has this src:
src="/appName/Images/img.jpg".
but the image is actually at "/Images/img.jpg". Notice the missing '/appName', this is the problem with every link / image.
The root folder of the application is in the folder '/appName', but the URL's/images seem to think it is one folder above that.
Now I could change every URL and take out the '/appName', but I feel like it should be possible to run the website correctly without changing the code. Maybe i should change something about the environment or IIS express.
HttpContext.Current.Server.MapPath("~") returns the path to the /appName folder. So the img src and a href start looking in /appName/appName which doesn't exist.
I have searched online, but cannot find anything.
I've already tried changing the root URL in applicationhost.config, but this resulted in IIS not finding an application in that folder.
I know the website works in the production environment, though i currently have no access to the production environment. But i do think it is an environmental setting (maybe in IIS).
So does anybody have an idea how to change it so the links think the root URL is one folder above the actual root folder in IIS?

Related

Access a website folder from another website in the same IIS

I have 4 independent ASP websites deployed in IIS server.
I access my website images using relativePath so i have root/path_to_files (something like that).
My problem is i want to access website1 images folder from website2 and so on, web3 access web4 (you get the picture).
I tried absolutePAth but security reasons (not safe) blocked me.
I`m reading the name and path of the repositories from a file.
What can I do, without remaking all or create a central repository(and upload all files there).
EDIT 1: using url is locked but i can unlock.
I can use url to get/list folders and images and use them ? Like resolve a url in a relativePATH to other website?!
Central repository the site is allready in production it will have big impact time/benfit to do that.
Have you considered symbolic links? You can make a shared image folder. Then each folder can see that "image" folder as its own.

aspx file path directory is correct but document won't load.

This is my first day in ASP.NET class. My assignment was to install IIS10 Express, then find the iis10.exe file in the user directory, run it, and copy the lab0.aspx document into Note++ coded in Visual Basis. After that I type the URL http://localhost:8080/lab0.aspx. I'm suppose to see the output in my browser. Instead I get a 404 error. I know I'm doing something correct because when I type localhost in the URL I see the Internet Information Services page. In my computer directory I see the aspx file. Here is what is looks like. Yet I can't figure out what I need to do next. Online I visited I looked up ISAPI extensions module, CGI, Internet Information Services Manager, etc. I'm here to ask for some help to steer me in the right directions. The file is where it's suppose to be, so why doesn't it load in the browser? I been going in circles for hours.

jquery not working in asp.net mvc after publishing to localhost

I've built an mvc application which contains some jquery code. When I run the app from my ide, everything works perfectly. When I publish to the server and open the page, the jquery does not work. I get object expected errors.
i am not getting anything in the page,it shows error in loading dhtmlxsheduler.js
can you help me out
You issue is most likely due to the way you are defining the path to the JavaScript file you are loading.
Make sure that you use a relative path, and not an absolute path when calling the file source.
If you have runat="server" you can also use the ~ operator, which ASP.Net translates to your home directory.
Read more here http://msdn.microsoft.com/en-us/library/ms178116.aspx
Your links to the .js files are broken. See the source code of your pages in your browser, and check the tag's src attribute. It must be pointing to the wrong place.
My guess is removing ../ do you have iis express? or development server? or iis?
Or use a CDN like this one from Google:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

Silverlight checks above the website root for 'clientaccesspolicy.xml'

We have a strange issue with a silverlight app which seems to centre around the 'clientaccesspolicy.xml' file.
We have a website, which is the default website on IIS7. In the root of this website we have the 'clientaccesspolicy.xml' file.
We also have a web service defined in a 'http://thewebsite/asubdirectory/service.asmx' which handles some of the silverlight requests to the website.
What seems to happen, is that when we try to load the silverlight component, there is an http request for 'http://asubdirectory/clientaccesspolicy.xml' which is clearly wrong.
What's odd, is that if I setup the default website to be blank, and setup this particular website as an application/virtual directory below the default website. e.g. http://thewebsite/subdomain/ then the request for clientaccesspolicy goes to http://thewebsite/clientaccesspolicy.xml and assuming I keep a copy of the file at the root of the default website, things work ok.
What I'd like to know, is how silverlight/IIS is determining that it needs to look further up that the root for the clientaccesspolicy when the website is defined as the default.
Could it be the service location or the service references in silverlight? Is there a sensible way round this?
Many thanks,
Doug
Silverlight needs to ask target site for cross-domain policy if it is not the same domain. So based on your "http://asubdirectory" I think somewhere your code is wrong and actually tries to use service at http://asubdirectory/someservice location instead of http://thewebsite/asubdirectory/someservice.

Getting Http 403.14 error

I have a MVC project and trying to host my web site using IIS 7.0 on my local desktop. My desktop has Vista x64 bit machine.
I'm getting 403.14 error. I have already tried the Microsoft suggestion, but that doesn't help me.
Does anyone know any other solution?
You may not have the default document specified properly in IIS. But without details, I can't tell you much more than that.
I just had this problem and tried several possible solutions, but none of the worked. It turns out that I had inadvertently created a directory structure that had the same name as my controller and activity.
For example, I had a URL like http://localhost:55501/Product/Preview/2 and there was also a Directory like ~/Product/Preview/2. I would have found it much faster, but I was certain I didn't have a directory named that way.....
So, double check that you don't really have a directory that is named with the same path as the URL.

Categories