virtual-path

How to resolve issue with image path when testing HtmlHelper?

不想你离开。 提交于 2019-11-30 13:48:54
I came across an issue when I was testing my HTML Helper. Basically I'm creating a grid with loads of rows, columns and different types of data in it. In the header there is also a image to notify the user what column the data is sorted by. However, when I'm writing my test now (way too late, but better late than never right?!), I get this error thrown: "The application relative virtual path '~/Images/SortingArrowUp.png' cannot be made absolute, because the path to the application is not known." var imgPath = VirtualPathUtility.ToAbsolute("~/Images/SortingArrowUp.png"); How can I solve this. I

How to OpenWebConfiguration with physical path?

十年热恋 提交于 2019-11-30 05:51:16
问题 I have a win form that creates a site in IIS7. One function needs to open the web.config file and make a few updates. (connection string, smtp, impersonation) However I do not have the virtual path, just the physical path. Is there any way I can still use WebConfigurationManager? I need to use it's ability to find section and read/write. System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration 回答1: You will have to map the physicalPath to a virtualPath. Here is how you would do

How to resolve issue with image path when testing HtmlHelper?

≡放荡痞女 提交于 2019-11-29 19:00:15
问题 I came across an issue when I was testing my HTML Helper. Basically I'm creating a grid with loads of rows, columns and different types of data in it. In the header there is also a image to notify the user what column the data is sorted by. However, when I'm writing my test now (way too late, but better late than never right?!), I get this error thrown: "The application relative virtual path '~/Images/SortingArrowUp.png' cannot be made absolute, because the path to the application is not