I'm deciding whether to add a file to version control. It's name ends with .pubxml.user. Can anyone tell me what it is? The fill name of the file is <name of our web server>.pubxml.user. It is evidently related to the publishing configuration.
The project is in ASP.NET MVC and C#, using Visual Studio 2013. the file is in the PublishProfiles folder.
Because this is a user-specific file, it should be excluded from version control. From https://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx, emphasis mine.
When you create a publish profile, two files are created in the PublishProfiles folder: .pubxml and .pubxml.user. The .pubxml.user file contains only a few settings that apply to a specific user, such as an encrypted password. By default it is not included in source control. Typically when you change settings related to a profile you edit the .pubxml file rather than the .pubxml.user file.
Related
Creating a new website allows you to choose the path of the website files. However, the project file itself is created under the Projects folder. How can I create it somewhere else? I would expect some field for that in the dialog, but can't find it.
(This is not a web-application.)
At least in VS 2013, there is no project file associated with web sites. There is only the .SLN file. The .SLN file is merely a simple container for all of the different websites and projects that you would like opened simultaneously in your Solution Explorer, so the location of the .SLN file on disk is not really important.
Still, if you would like to control its location, you cannot do so through the New Website dialog. You'll have to manually move the .SLN file after you've already created the website. And in doing so, you would also have to open up the .SLN in a text editor and manually adjust all the relative paths to point to your website location.
I am currently getting this when visiting my http:// websitehere.com/excelData.aspx page:
This is a marker file generated by the precompilation tool, and should not be deleted!
The file system directory on the server looks like this:
--mainDir
|--excelData.aspx
|--PrecompiledApp.config
|--Web.config
|--bin
|--App_Web_cuydkh1j.dll
|--exceldata.aspx.cdcab7d2.compiled
Not sure what I need to add/remove in order for it to display my page without that precompilation tool text on it.
The IIS server is version 6.1
One of the reasons for this problem is the file PrecompiledApp.config is missing from the root of your site (this file is generated by the publishing wizard).
Hope this help others.
Problem:
When you upload the web application, sometimes the most important files in the bin folder (e.g., the .dll files) will not upload correctly.
Solution:
Re-upload the bin folder. Remember to overwrite.
Make sure the site is configured as an application on IIS
I have an application where I have an XML file which holds the connection string.
When hit the URL with the exact file name it opens the file in the browser that is natural.
Now I need to restrict this file browsing and I can not change that code to do any redirect or anything else.
What I have tried is using denyurlsequences in the security tag in the web.config but it restricts the application too to access the file and that makes the application stop working.
I am using .NET Framework 2.0
The ".xml" file extension is not supported by ASP.NET pipeline that is why you cannot add it to web.config and restrict it. What you can do is to copy the xml file in the "App_Data" folder of your application.
The purpose of this folder is to hide it files from browsers/users and also is build for this type of data.
To create "App_Data" folder if it already does not exist :
Right click on your project -> Add ASP.NET Folder -> App_Data
Or just add a folder and call it App_Data
I know its old question but this answer may be helpful for others.
I did below configurations on IIS 8.5 ( make sure Request Filtering is installed on IIS.)
Open IIS and click on your application virtual directory.
In features View, Click on Request Filtering and then go to Hidden Segments tab - this tab will contain list of hidden files or folders. (like web.config, APP_data folder etc...)
Add file or folder you want to hide from the browsing by click on add hidden segment and mention file/folder name you want to hide and test it.
In our application we have a master xml file stored in an application folder, to deny browsing this xml file I had added the folder name in hidden segments and it worked.
Whenever I update a small part of my website I have to upload whole website again.
If i upload only edited part it throw me exception.
The way I upload my website:
For example if I have 4 pages (home, register, about me, contact me) and if I update home.aspx, I publish whole website in a local address, and then I compress it with zip format and upload it manually.
Is it possible to publish only updated part?
It is not possible to publish only a part of website, but what you can do is to choose Single-File Assembly build option ,by this you can get single assembly for your page.so intead of updating whole application you can update only the pages you change
read more
What I always do when publish ASP.Net Webform project, I complate it with two steps. Maybe this way suitable for you.
When you use publishing tool on visual studio by selecting Build menu -> Publish, you can choose "File System" as "Publish Method", type your "Target Location", and select "Replace matching files with local copies". It mean the project will publish modified files only.
After publishing have done, Open defined "Target Location" using windows explore and sort by "Modified Date" and just copy newer modified files for each directory recursively to your server.
If you build the website pages into dll. You can not published only the aspx. there are many other dll and compiled files in bin folder, we don't know which matches which aspx.
If you only edited the "view", i mean, the html and markup part of <%%> code, and no code behind (.aspx.cs) change, you can published only this aspx. But remember to set website as updatable in the publish dialog.
I suggest you to compile the aspx into one dll. according to #Buzz 's answer. Then, your aspx files would be only an empty file. All you need to do is upload only one dll to the bin folder.
I've written an ASP.net web application. In the interest of following the advice in "The Pragmatic Programmer" to put application logic in configuration, I wrote a large XML file that describes various business rules.
When I test the application on my local development workstation, I copy the file to c:\xxxxx\myfile.xml and then write the code to read the file from this location.
What is the correct way to deploy this xml file as part of my web application so that it gets read from the directory in which the web application is deployed?
Update: The XML file in question is for server-side configuration and should never be available for download to the end-user.
If you're not embedding this as a resource, you should:
Create a directory under which this file will reside.
Create the file and set its Build Action to Content.
Create a web.config file in that directory which forbids access to the directory so you don't expose your business rules to the Internet.
Add a setting in your application's main web.config that gives the path to this file relative to the root of the application, i.e. "~/MySecureFolder/MyBusinessRules.Xml".
Have some code that calls HttpServerUtility.MapPath Method to convert the value from the setting in web.config to a virtual path.
I don't know if this is what you want - Click on the XML file, then open the Property Window and find the "Build Action" property. Set the value to "Embedded Resources"
I think what you need to do is:
Add the XML file to your web application project in Visual Studio
Right click on the file and select 'Properties...'
Set the Build Action to 'Content' and Copy to Output Directory to 'Do not copy'
this will ensure that your XML file is deployed along with the rest of your web app.
If you want to make available your XML file from http requests to your server, you should
place it in your web publication folder.
This ASP instruction should help you to find your publication path:
Request.ServerVariables("APPL_PHYSICAL_PATH")