C# - Using Embedded File In VS2008 Project?
Aug 19, 2010
I have an ASP.NET project and want to include an XML file inside the project to store some relatively static data. To do this I selected "Add File" from the solution context menu and picked my XML file. Having added this to my project, I then wanted to load the XML from within code. I tried the following:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("MyData.xml");
I also tried:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("~/MyData.xml");
But it seems to be looking in the current directory (i.e. my VS2008 directory) and not the project. Am I going about this wrongly? Is there a way to simply reference a resource that's embedded in the project like this?
View 2 Replies
Similar Messages:
Jul 29, 2010
I need to migrate a ASP.NET application from 1.1 to 3.5. I have gone through the answers on this forum already, but still have some questions
should I convert the application from 1.1 to 3.5 directly? OR convert it to 2.0 first and then to 3.5 and the reasons for doing so.Is there any article that walks through the whole conversion process from 1.1 to 3.5 with solutions for any typical issues encountered during the conversion process?Is it possible to convert a ASP.NET 1.1 project to ASP.NET 2.0 using VS2008 OR do I need to use VS2005 IDE for doing so?
View 3 Replies
Jan 10, 2011
I need to uplaod photo in my VS2008 project. Can I use FileUpload control or link button is the better option. Also, how to do the upload using both controls.
View 13 Replies
Apr 23, 2010
I am using VS2008 under WINXP, I have a project which the ASP.NET version is set to 3.5.
The code: Response.Write(System.Environment.Version.ToString) prints out 2.0.50727.3603
After checking in http://en.wikipedia.org/wiki/List_of_.NET_Framework_versions I found out that the ASP.NET version is 2.0 SP2.
How can I set my project to ASP.NET 3.5 ?
View 9 Replies
Jun 7, 2010
Is there a difference between the Web Setup Project in VS2008 and the Web Deployment Project that I keep reading about on this site? More importantly, how much of a help is the deployment project over just using the setup project?
View 1 Replies
Jan 20, 2011
I have a vs2005 web application project,I upgraded my machine from xp to Windows 7, the web application project not working in vs2005 anymore, does anybody know why windows 7 not support web application project for vs2005? if i upgrade vs2005 web application project to vs2008, will that work in windows 7? and after upgrade, will the original web application project still a web application project or it upgrade to website project?
View 3 Replies
Nov 3, 2010
I have been working on this project for a few months in VS2008.. now that we are getting closer to the end, one of the other programmers has been working and doing his in VS2010, so when i try to open his projects in VS2008 it just shows up as XML.. so i have to open in VS2010.. thats fine..
But if i try to open my project in 2010, it prompts to use the conversion wizard.. Should i be concerned or are there any issues with doing the conversion? Being the end of the project, i dont want to cause issues at this point.. So would like to know if converting the project file at this stage in our project a good idea? Will there be any issues using his code with mine since they were developed in 2 different versions..
View 1 Replies
Feb 28, 2011
I have a vs2008 Website project(it was converted from vs2005), when i right click the Website node in the solution and open the property page, i select the references link, then click add reference to Oracle.DataAccess.dll(11g, 64bits), Version=2.112.2.0 in the website BIN directory, it doesn't work, i don't see the Oracle.DataAccess.dll is added, Can you give me any advice why the website project can not add the Oracle.DataAccess.dll ? And I can add rOracle.DataAccess.dll to my other Web Application project, what difference between Website project and Web applicatoin project caused the issue? Since i can not add the Oracle.DataAccess.dll , when i compile, it gave the error:
Could not load file or assembly 'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format.
View 4 Replies
Nov 29, 2010
F5 builds the web project and the opens the web site but the project is not in debug.
This has happened over the last week but I was not aware of making any relavent configuration changes or updates.
View 2 Replies
Feb 25, 2011
I have an ASP.Net project created by a team member on another computer. The project references a virtual directory that exists on my computer but under a different localhost location.Currently, the following error occurs when I try to open the project:
The local IIS URL http://localhost/foo/default.aspx specified for Web project foobar has not been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?[Yes] [No]
So, there are two options: select yes: It creates the virtual directory that it thinks I need, which I don't want to do. I already have a virtual directory somewhere else.
select no: This isn't an option, as the project opens, but without all the bells and whistles I know and love.
Where is the virtual directory location (in my case http://localhost/foo/default.aspx) specified within the project? Can I change this manually, say in a configuration file within the project, either before or after I open it? A configuration change seems more ideal than manually opening IIS to override a virtual directory path.
EDIT (solution): Buried in the comments below is the following answer (Thanks @Thyamine)This can be configured in the foo.csproj file for the project. Look for the lines:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{F00-000-000}"> [code]....
View 1 Replies
Apr 3, 2010
I have a class library. In one of the classes, I am adding a script reference on the page like this:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (this.Page != null)
{
ScriptManager sm = ScriptManager.GetCurrent(this.Page);
ServiceReference reference = new ServiceReference("~/Admin/Services/ContactsService.asmx");
reference.InlineScript = true;
sm.Services.Add(reference);
}
}
For the ServiceReference file path, is there a way to add an embedded file instead? I want to keep everything self-contained in my class library instead of dropping a file into the website folder.
View 1 Replies
May 11, 2010
Question: Is it possible to embed .skin files as a resource?
I am creating a library of user controls(grids, buttons, etc.) that are common among all of our web projects. I have included several common javascript files used by the controls by adding them as an embedded resource and registering them as a resource using RegisterClientScriptResource. Everything works great.
However, the last thing I would like to do is embed skin files in this project so that all the controls have the same look. I know I can control look solely with css, but I would like to control some of the other asp attributes as well(ie AllowSorting and AllowPaging attributes of a grid). Is it possible to embed skin files as a resource? Or will each individial project need a copy of the skin file? If anyone could provide insight on how I can go about embedding a skin file..
View 1 Replies
Sep 3, 2010
I have a question about javascript. In my project, there are embedded and non-embedded javascript codes. And i did localization of the embedded codes like below and it works.
CN.DEFAULT_CONFIG = {
strings : {
year: '<%=GetGlobalResourceObject("Resource", "YEAR") %>'
But, this method does not work for non-embedded javascript codes. How can i do localization for them?
View 1 Replies
Mar 18, 2010
I have built a custom control that includes a .js file that needs to be referenced. I set the file to be an Embedded Resource under the Build Action. I then referenced it in the class like this:
[Code]....
View 2 Replies
Mar 24, 2010
Can I use VB and C# classes together in the same asp.net 3.5 project?
View 3 Replies
Feb 1, 2010
I have a .swf file embedded in my asp.net webpage. It is slow to load although the size of the file is 1.60 mb. What might be the reason for the slowness? Is there a way I can speed it up in asp.net?
View 1 Replies
Jul 4, 2010
My objective is to include a JavaScript file in my Custom Server Control, because it's a bit tedious writing all the JS in C#. I've done a lot of searching and most resources seem to say that I need to add the file as an embedded resource, and access that. I found a few pages describing how to do this:
[URL]
They all seem to say I need to, after adding the JS file, change the build action to 'embedded resource' through its properties. However, the only properties I can actually see on the file are 'File Name' and 'File Path'. Right clicking the file in the solution explorer doesn't allow me access to properties, and right clicking (as one of those links suggests) anywhere else doesn't expose it either. I tried looking through VS Options but couldn't find anything, although I get the impression that I have something configured wrong that's not allowing me to see as many properties as I should be able to.
View 2 Replies
Sep 16, 2010
I have spent last couple of days on this subject but no luck :)
I want to achive following using VS2008/C# -
1. create a cab file using existing AciveX/ocx control,
2. use the ActiveX on ASP.NET WebForm.
3. deploy the app and cab file on web server
4. Test/verify that the cab file get downloaded, and IE can use my ActiveX/ocx
I found one nice tutorial on this but it is with VB.Net (not VS2008) -
[URL] (the problem I get with VS2008 - can's see Authenticode Signing check box, or add ActiveX to Toolbox).
View 3 Replies
Jan 27, 2011
I am trying to connect linq to dbf file. I am using VS2008 on windows xp with sp2. For most part I can create a connection and see the tables in the server explore, but when I try to drag and drop a table onto the .dbml i get "The selected object is an unsupported data provider". I have been trying to use FoxPro to connect to the DBF. In VS in the Data Connections I go to modify the connection and hit test and the connection says success, but no tables appear.
View 1 Replies
Jan 16, 2010
Im working on windows 7 operating system now and having a few issues with the sql server. I had visual studio 2005 and sql server express 2005 installed on my machine 1st. i then got visual studio 2008 and installed sql server express 2008. when i try and create a new database in the App_Data file (sql server database *.mdf file) i get the following error message;
"Connections to sql server files (*.mdf) require sql server express 2005 to function properly. Please verify the installation of the component or download from the url: http://go.microsoft.com/fwlink/?LinkId=49251"
I was just wondering what way i could create a *.mdf file looking into sql server express 2008. I also found out that sql server express 2008 management studio is not compatible with windows 7 yet..?
View 8 Replies
Mar 8, 2011
Under Visual Studio 2010, I'm developing an asp.net application. I added a folder to my project called Flash. Under Flash folder I added a swf file with its external resources to run.
The folder content:
1- ScrollingImages.swf file to lunch the flash
2- ScrollingImages.xml file that the swf file uses to read images from thumbnails folder
3-thumbnails folder which content images used by swf file. I can embed the swf file to html easily using this code:
[Code]....
But when I use the same code to embed it to asp.net page I will have a problem that the flash will run but I cannot see the images so the swf file unable to locate the xml file and the folder of the images location and they all in the same folder.Here is the code I used in the aspx.net content page.
[Code]....
I also tested it in aspx.net page and I'm getting same result no images appear. I know that the problem is related to who to embed the swf external resources (the xml file and the images folder) to the aspx.net page but I searched a lot and I could solve it.
View 1 Replies
Jan 18, 2010
I have a question about security. If I put the ip address and full path for my swf file which is embedded within my asp.net application I can access it. I do want anyone to access that file. The file should only be viewed upon logging in to the asp.net webportal which displays it as an embedded flash animation.
View 1 Replies
Mar 31, 2010
I currently have a file "abc.htm" in my Custom Server Control Project and it's Build Action is set to Embedded Resource.Now in the RenderContents(HtmlTextWriter output) method, I need to read that file and render it on the website.I am trying the following but it's to no avail:
protected override void RenderContents(HtmlTextWriter output)
{
var providersURL = Page.ClientScript.GetWebResourceUrl(typeof (OpenIDSel), "OpenIDSelector.Providers.htm");
var fi = new FileInfo(providersURL); // <- exception here
//the remaining code is to possibly render the file
}
This is an example of how the providersURL is:
/WebResource.axd?d=kyU2OiYu6lwshLH4pRUCUmG-pzI4xDC1ii9u032IPWwUzMsFzFHzL3veInwslz8Y0&t=634056587753507131
FileInfo is throwing System.ArgumentException: Illegal characters in path.
View 1 Replies
Jan 30, 2010
I am very new to ASP.Net and Visual Studio 2008. I am attempting to run a website on my Windows 7 Enterprise usig IIS7. When I load the web.config file in the VS2008 editor I get several errors/warrnings. Each starts with "Could not find schema information for the element 'TinyMCE' or it specifies one of the attributes.The section of code looks like this:
<TinyMCE installPath= "script/tiny_mce" mode ="src"
<globaoSettings>
<add Key ="relative_urls" value ="false" />
[code]...
View 4 Replies
Mar 4, 2010
i have the project files which consist of some folders and some aspx and aspx.vb files.
I do not have any solution file or .sproj file in it.
so I need open a single file at a time and I can not debug the whole project or any single file also.
Do I have to generate a project file or solution file,
I just wanted to open the whole project file by opening a single file in VS 2008.
so that all the folder structure and the files I can view in solution explorer.
View 1 Replies