Running Asp.net Site - Cannot Have Files At Root
Sep 28, 2010
I am a PHP developer and have been asked to make some slight amendments to an ASP.net site. I can make these amendments but the biggest challenge seems to be getting the actual site up and running on my own server! I have a had lots of errors with regards to the paths to files, as the website is linked absolutely to the root folder and on my development server I cannot have the files at the root. I have therefore worked my way through some of the files making the paths relative so I can at least see some of the site running but then I came across this error:
CS0103: The name 'Data' does not exist in the current context
Line 5: protected void Page_Load(object sender, EventArgs args)
Line 6: {
Line 7: rptNews.DataSource = Data.NewsArticle.GetLatestNews(3);
Line 8: rptNews.DataBind();
Line 9: }
I assume this is something to do with data being called from a database. How to get the site and database up and running as I have no idea where to start and feel I am going round in circles.
View 4 Replies
Similar Messages:
Feb 11, 2011
I am using iis 5.1 in which we have only only one default website, I have two projects v2 and v3 my website points to v2 projects and have some folders images, styles etc now i have a virtual directory under this website that is hosting project v3 and having the same folder hierarchy as v2 in the home page of the both projects i have img src="imagesedlogo.gif" alt="logo"/> but this shows the same image that is in the v2 directory, How can i show different images for both projects. using "" get the root of the web site but how can i get the root of virtual directory under that website
View 2 Replies
Jan 9, 2010
I have an ASP.net Website. the project' content is in a folder called MyWebSite. When I run my application from Visual Web developer 2008, the browser displays the following address in the address bar: http: // localhost/ MyWebSite /Default.aspx
I want to be able to run my Website from the following address:
http://localhost/
View 3 Replies
Jan 3, 2010
Is not a lot of fun of yielding much success at the moment.
When I copy my web site on the local machine some of the CSS classes in my themes are not applied. Although not major, I am concerned at what may be causing this.
My real problem is regard the root of the site. On my personal machin, I have set the root of my site using the tilde syntax. However, the root of the web site on my host's ftp site is wwwroot.
Does this mean that I need to change a setting somewhere for the page to be recognised?
View 4 Replies
Apr 4, 2011
I want to completely understand how to use relative and absolute url address in static and dynamic files.~ : / :.. : in a relative URL indicates the parent directory . : efers to the current directory / : always replaces the entire pathname of the base RL// : always replaces everything from the hostname onwardsThis example is easy when you are working without virtual directory. But i am working on virtual directory
View 1 Replies
Jan 27, 2011
On a MVC 3 site I have a area named "CMS" on on CMSAreaRegistration I have:
[Code]....
All the CMS controller are under the namespace Site.CMS.Controllers And in Global.Asax I have:
[Code]....
The CMS routes seem to work as expected. But the following link on my site root:
[Code]....
I tried many options to try to solve it but I always get something wrong.
View 13 Replies
Mar 26, 2011
So my website works great on my local computer. It also works fine when I use the Copy Web Site feature in Visual Web Developer 2010 Express. But I do not want all of my files and the default.aspx to be sitting at the root of my domain name. I want it to be in a subfolder.
So again, it works fine when it's sitting at www.domainname.com
But when I use my FTP program to move the files to:
www.domainname.com/subfolder/
I get an error when I try to visit the site. It's just a general runtime error and does not display the specific error message. It obviously must have something to do with when I MOVE the files/folders from the root of the domain to the subfolder?
View 2 Replies
Apr 28, 2010
I know that to use link a view found in one view to one in another, i need to use;
[Code]....
But what if i want to link FROM an area to a view in the root of the site? This view is in the views folder found in the root, NOT in any area.
View 2 Replies
Aug 18, 2010
I've got webform routing setup on my asp.net webforms 3.5sp1 project. I would like to have the files for the site in a directory called content including the home page as I would like to run multiple sites using the same system. In MVC there is a blank default page and the home page is in a folder called home. I can't seem to replicate this behaviour using web form routing but would like to. The blank page is always hit first. the route handler is hit second - it recognises that the request is for the home page and sets up the routing page but is not used. the route handler code is simple:
public string VirtualPath { get; private set; }
public IHttpHandler GetHttpHandler(RequestContext
requestContext)
{
string file = requestContext.RouteData.GetRequiredString("File");
string id = requestContext.RouteData.GetRequiredString("Id");
string queryString = "?menuid=" + id;
VirtualPath = "~/" + file;
HttpContext.Current.RewritePath(
string.Concat(
VirtualPath,
queryString));
var page = BuildManager.CreateInstanceFromVirtualPath
(VirtualPath, typeof(Page)) as IHttpHandler;
return page;
}
Is there anyway I can do this?
Update
Here is my global.asax route code:
public static void RegisterRoutes(RouteCollection routes)
{
Domain.RepositoryFactory repo = new RepositoryFactory();
foreach (var x in repo.MenuRepository.GetAllEnabledGetMenus())
{
if (string.IsNullOrEmpty(x.Url))
{
//add default
System.Web.Routing.RouteTable.Routes.Add(
new Route("Default.aspx",
new RouteValueDictionary(new { File = x.FileName,
Id = x.Id.ToString() }),
new CoreRouteHandler()));
}
else
{
string url = x.Url;
if(x.Url.StartsWith("/"))
{
url = url.Remove(0, 1);
}
System.Web.Routing.RouteTable.Routes.Add(
new System.Web.Routing.Route(url,
new RouteValueDictionary(new {File = x.FileName,
Id = x.Id.ToString()}),
new CoreRouteHandler()));
}
}
}
View 2 Replies
Apr 30, 2010
Suddenly, IIS 7.0 is redirecting every request for the root of any domain hosted on the box to ~/Account/Logon, which is our Forms Authentication redirect. Additionally, some JavaScript and image requests are being similarly redirected, but not other aspx pages.
EDIT: It turns out that something has gone wrong with the disk permissions. Can anyone point me to the way things are supposed to be in Windows Server 2008 for a standard ASP.Net installation? The disk permissions are out of whack now.
View 1 Replies
May 17, 2012
I am using url rewriting rules in my web.config and have it working but today I added a rule in a folder but my primary rule keeps overriding.
Web.config
Code:
<rewriter>
<rewrite url="~/folder/*_a_(.+).aspx" to="~/folder/index.aspx?id=$1" />
<rewrite url="~/*_a_(.+).aspx" to="~/listing.aspx?id=$1"/>
</rewriter>
Usage:
www.domain.com/topic_a_1.aspx -> This would load listing.aspx?id=1 which is great.
www.domain.com/folder/newtopc_a_2.aspx -> This is also loading listing.aspx?id=2 but should be loading index.aspx?id=2
I believe I need to change the second rule from *_a_... to something like [^/]_a_.... but that doesn't work.
What I can do so the second rule doesn't override my sub folder rules?
View 2 Replies
Jul 16, 2010
I have an ASP.NET application running on Apache server with mod_mono. If I have a folder called "temp" located in the website's root directory and run the following code
System.IO.TextWriter tw = new System.IO.StreamWriter("temp/test.txt");
tw.WriteLine(DateTime.Now);
tw.Close();
it saves test.txt in C:Program FilesMono-2.6.4in emp on the server. If I add a slash to the directory name like this: System.IO.TextWriter tw = new System.IO.StreamWriter("/temp/test.txt"); It saves it to C:/temp. Both do not do what I want. How do I get the code to save the file to the temp folder inside my website's root directory? Is this a mod_mono issue or something to do with Apache? I have tried adding this line to httpd.conf Alias /temp "C:/Path_to_root_folder/temp" without any luck. I shouldn't have to use alias if the temp folder is within the root directory, correct? In my development environment which uses XSP as the web server everything works as expected. It is only a problem when running on Apache.
View 1 Replies
Oct 18, 2010
I have a website(not an application) built in VS2008. When I try to publish the site, any of the files that are in the root folder are not published. This has only just started happening and I am unsure what I have changed to cause this. The files are not excluded from the project.
View 1 Replies
Jun 9, 2010
folders in my website root are
a
b
c
I have subdomain "s1" which points to "a" folder. I want to know how could I access to files stored in "b" folder form subdomain "s1". My issue is that files I have some html content which saved in DB Records and their path are base on webroot i.e. "<img src="/b/movie1.avi" /> .Could any one tell me how I could show these files via subdomain "s1"
View 1 Replies
Jun 14, 2010
I just inherited an ASP.NET WebForms web application that I was tasked with refactoring. One of the features is a file upload and while debugging I noticed that as soon as a file is posted to a certain page/handler, it is automatically uploaded to the root directory of the application. The file is then moved to the proper location. I can't seem to figure out whats causing this automatic upload of the file. Is there something I'am overlooking in ASP.NET WebForms that allows this to happen? Is it an IIS configuration or something?
View 1 Replies
May 31, 2010
I am slowly working out the setup issues with Visual Studio 2010 Ultimate on my newly installed Windows 7 Professional Machine. I was running XP and copied most of my files back over using the 'Windows Easy Transfer' tool I used prior to installing (not an upgrade) Windows 7.
When I try to publish my website to wwwroot in 2 ways. When I select 'Delete all existing files prior to publish' I get the following error:
Error deleting file 'about.aspx'. Unable to delete 'about.aspx'. This function is not supported on this system.
When I use 'Replace matching files with local copies' I get this error:
Unable to add 'about.aspx' to the Web site. Unable to add file 'about.aspx'. Access is denied.
View 2 Replies
May 1, 2010
I've created a site using Visual Web Developer 2008 Express Edition (ASP.NET 3.5) but the server hosting it runs ASP.NET 2.0. I'm getting some odd errors running the live site. Is there anything I need to be aware of? Do I need to make any changes to the web.config file (that was generated in VWD) or anything else?
View 2 Replies
Jan 27, 2010
I ran into the following issue when trying to run a test website on IIS 7.5 (Windows Server 2008 R2 DatacenterEdition). The web-app is configured to run with framework version 3.5 in a .Net 2.0 app pool. Also the framework 4.0 beta 2 is installed on the server. The application named 'TestPfade' is located under the website's root named 'Default'. It is not only a virtual directory but defined as an application. The folder structure looks like this: The markup of the sole document reads as follows:
[Code]....
When viewed in a browser the image gets shown because the given relative path is correctly resolved to 'images/Lighthouse.jpg' but the paths to the ajax-framework resources also include the application's root folder and therefor aren't found: 'src="/TestPfade/WebResource.axd?d=1bX...' Here is the complete html-source generated:
[Code]....
View 9 Replies
Apr 22, 2010
I am working on a site where I need to set different countries get restricted. The selected countries don't able to download the contet of that site? How do I do this.
View 3 Replies
Sep 9, 2010
I am trying to have a marker show whether or not a particular service within the services.msc is running on a remote server(s). I have a service called Yardi Services on a virtual server. I want to be able to show on a dashboard I am creating for work, whether this service in running or stopped. For some reason this service will randomly stop though I have a auto restart on error. I am assuming that I would need to create a web service or use WMI?
View 2 Replies
Jul 9, 2010
How to check in ASP.NET MVC View if site is running on localhost or 127.0.0.1?
View 2 Replies
May 27, 2010
[URL] Does anyone know why is generating this strange folder path?
View 2 Replies
Sep 17, 2010
How can you request the root default.aspx without specifying it in the url for your root application?e.g. ttp://localhost/MyApp/ instead of http://localhost/MyApp/Default.aspxshould be able to do bothI'm not sure if this is a setting in IIS 7.5 for the application or what.
View 3 Replies
Feb 19, 2010
I get the following error while running ASP.Net Web site administration tool: ASP.Net Web site administration tool I am using visual web developer 2008 express edition and windows XP pro version 2002 service pack 3. I am following Microsoft Visual web developer 2008 express edition by Eric Griffin and in chapter 4 I need to use the administrator tool to set up passwords.
View 1 Replies
Mar 21, 2011
am looking to add a contact page to my asp site that I am running vie IIS6.0I have created the page but just need help with the code i would also like to send the user to a thanks page once the Web Form has been sent.It also has a drop down menu and the email is sent to that address! If someone could help with the coding ect that would be a massive help. The codeing I have so far:
[Code]...
View 4 Replies