Web Forms :: Can Change The Applicaiton Virtual Path At The Runtime
May 1, 2010Can I change the applicaiton virtual path at the runtime
View 1 RepliesCan I change the applicaiton virtual path at the runtime
View 1 RepliesI created a web setup project. When the users install it, the virtual directory gets created and all the files are created under "C:Inetpubwwwroot<myvirtualdirectory>".
How to customize the web setup project so that I can change the virtual directory physical path? I had followed the tutorial
[URL]
but it didn't work and my MSI stopped installing alltogether.
I have a code to open PDF file, like this
[Code]....
Over here I have created a folder with name Data inside my solution, so the Server.Mappath("Data") as well the statemet for converting assigning the src property of the IFrame I1 is working properly. But I want to use the files from a folder which resides in a network folder like
I am trying to upload a file Into a MapPath but I am getting a error 'C:/WebSite/userimages/' is a physical path, but a virtual path was expected. My code is:
[Code]....
the syntax to convert a virtual path to a physical path.
I wanted to upload a file located in one server and i know only the website name.
I am trying to convert the virtual path to a physical path but don't seem to have Server.MapPath or HttpServerUtility.MapPath available in my handler. I add the System.Web namespace with no luck.
string virtualTargetFolder = String.Format("~/UserImages/{0}/Images/", user.ProviderUserKey.ToString());
string physicalTargetFolder = System.Web.HttpServerUtility.MapPath (virtualTargetFolder);
How to give absolute path, that working with virtual directory and localhost
/Image/Icon.jpg - it is working well with localhost
/Image/Icon.jpg - It is not working on Virtual directory
I want absolute path solution which is working on both virtual and localhost directory
I am new to asp.net and trying to build a top level in asp.net. Actually i want to save .aspx pages in sql server database and excute directly from the database. I search a lot and come to know about VirtualPathprovider class. It is helpful in building cms like what i want but the problem is that i am quite unable to understand the use of this class.
View 1 RepliesMy basic question is, can a virtual directory in IIS point to a physical path that's not on the local machine? For instance, right now I have a virtual path /NaturalGasReport/NYMEX which points to physical path C:Program Files (x86)NymexSettleNATGAS_REPORTNYMEX, but I want it to point to a physical path on a difference PC on the same network. Is this possible? (I know I can just try it out so I apologize for asking but I thought it would be best to get an explanation along with "yes" or "no"). If you want more detail, this is what I need to do. To make a long story short, because of a vendor product we are using that won't run on a 64-bit operating system, I have to run a program called Generate_NGReportData.vbs (it's a vbscript program) on a PC I will call 28. It uses a vendor product which produces jpg files which are graphs of the Natural Gas market. The machine where I wish it could run is called RTEST01 but this machine runs a 64-bit OS and the components won't work there. RTEST01 has the databases. So, I created a datasource on 28 which points to RTEST01's database. The vbs program will read the data, generate the reports, and write one row to a database table on RTEST01. RTEST01 has to run the complimentary program which sends these reports (via email). 28 is not an email server so it can't email the reports. So on RTEST01 I will run Send_NaturalGasReport.vbs. This program creates an email body of html. The html references [URL]NaturalGasReport/NYMEX/" & Day(nymex_update_dt) & ".jpg which is a virtual directory pointing to C:Program Files (x86)NymexSettleNATGAS_REPORTNYMEX. I need it to point to the folder and files on 28.So if my initial question has a simple yes answer then I am all set. If not, examine my architecture and propose an alternative solution.
View 10 RepliesRequest.Path will get the current Path name with file name such as:
C:/......./Personal/Items.aspx
How can I get the only Path name such as:
C:/......./Personal
OK, I've seen a lot of ambiguous errors, but this was is in the top 20 or so. I have a RenderPartial that looks like this:
[Code]....
When the view loads, I get this error:
The relative virtual path '~Areas/User/Views/Shared/ProjectStats.ascx' is not allowed here. That really helps. Why isn't it allowed there? What's wrong with it? Just above it I have other PartialRender calls that work without a problem. They're created exactly the same way. Here's another:
[Code]....
This works fine. I thought maybe it was due to accessing a view from another Area, but I added a partial view to that Area's folder and it still didn't work.
How can i resolve a virtual path to a file into a path, suitable for the browser, from within a generic .ashx handler?
e.g. i want to convert:
~/asp/ClockState.aspx
into
/NextAllowed/asp/ClockState.aspx
If i were a WebForm Page, i could call ResolveUrl:
Page.ResolveUrl("~/asp/ClockState.aspx")
which resolves to:
/NextAllowed/asp/ClockState.aspx
But i'm not a WebForm Page, i'm a generic handler. You know, that IHttpHandler object with all kinds of things injected:
[Code]....
I have successfully created my own virtual path provider to load a user control embedded in an assembly. The problem I am facing is I cannot use any embedded string resource in MyUserControl.ascx:
<Label runat="server" ID="MyLabel" Text="<%Resources: SR, Welcome%>"/>
This will cause IIS to throw a compilation exception at runtime saying the resource SR.Welcome is not found. I guess ASP.NET runtime looks for the string resource SR in the main assembly instead of the one that contains my user control.
To start with then we have a LinkButton whose text is actually an image tag. The image it links to is a Png and resides in a folder in the web directory. This is IIS V6 and win Server 2003.
The path is [URL]
Admin is a virtual directory configured in IIS.
The above url doesn't work but if you change it to [URL] (lowers case 'a') then the image is served, change it back to 'A' and it takes you to login, you log in and it loops back to log in. change to 'a' and voila the image is served. Weirdly this problem doesn't always occur and I have hunted for a resolution for days to no avail.
As requested this is the complete link button
<asp:LinkButton ID="lnkCommitAll" runat="server" CausesValidation="false"><asp:Image ID="imgCommitAll" runat="server" ImageUrl="~/Images/Grid/confirm_16.png" AlternateText="Commit All Changes" /> Commit All</asp:LinkButton>
I am trying to profile the number of "Anonymous Requests" for an ASP.NET web application using perfmon. When I select this key, I have to pick a process of the form _LM_W3SVC_#_ROOT. How do I map the IIS metabase path back to the web application?
View 1 RepliesI have created a setup for my application which is having both website and desktop application. i m supposed to changes connection string in both the config files at runtime. i used following code :
[code]...
I created a virtual directory in the Visual Web Developer, according to this post:
[URL]
I want the user to upload / download documents in the mvc app to that virtual directory. When a document is uploaded, I'm specifying the path to the document to be stored for later retrieval like so:
~/VirtualDirectoryName/FileContent.docx. But when I try to open that as a link in th app,using ResolveUrl, it appends the port number after localhost like so,[URL], I get a document not found, since it really should be, [URL].
It took me 6 hours to figure this one out and I'm wondering if someone can give me an answer why it has to work this way. I have two PCs, one is a webserver win2k 2003 and the other is the file server running Windows XP. Both PCs are on the same company domain therefore they can see each user. The share folder has NETWORK, NETWORK SERVICE, USERS (which include IIS authenticated users), a LOCAL account, and a specific User (which is me) that is given access to read. In my web application, I call a server.mappath. In IIS6.0, anonymous is disabled so users use integrated Windows Authentication. I can see this by verifiying User.Identity.Name.ToString(); Next, I also check WindowsIdentity.GetCurrent().Name.ToString();. In my first run, I set impersonate to true and thats it. Both User.Identity and both Windows.Identity show: mydomainsmith_B as an example.
When trying to access the UNC virtual path whcih has "Always use the authenticated user's credentials when validating access to the network directory" checked. This means , IIS6.0 will pass mydomainsmith_B credentials to the file server. I get an access denied which is verified by a thrown exception. I go back and check the file server and under the security tabs, I did add myself which shows smith_B under the security and for kicks, I'm also under Share tab.
Next, I try to authenticate using a "LOCAL" account on the file server. The local account is called username/password: temp/temp. So I set web.config to impersonate=true, userName=temp password=temp. Okay, so I go back into IIS 6.0 and for the virtual directory, I go to "Connect As" and set Username and password to: temp/temp and un-check "always use the authenticated user's credential". Finally, i reload the page. This time the page shows me:
User.Identity.Name: mydomainsmith_B
WindowsIdentity.GetCurrent().Name: temp
perfect, so now I'm impersonating temp. I click a button to access the UNC path and boom, it all works. So why doesn't my local PC authenticate ME, as MYSELF, which is on the domain, which is on the same domain. Why do I have to impersonate a local account to the file server? Why can't I just impersonate myself? Also, If I disable impersonation, it becomes NT AUTHORITYNETWORK SERVICE. This service also can't access the UNC path even when I have enabled the same security and same share settings.
I ahev seen many discussion related to this , but I could not find proper answer , I have live web site set up on IIS 6, and set virtual path MYSite and then phisical path to the web.config file on actual location.
I have copy this site to another server for the purpose of further development, so I need to run production site exactly same as live site , i can do edit in production and update pages to live.
Once I have copied the site give this error virtual path '/includes/menu.htm' maps to another application, which is not allowed
i have master page include menu as html files <!--#include file="../includes/topmenu.htm"-->
I have open site in IIS 7 and add virtual directory and gave a name (not same as live) and choose physical path to the root folder of the site. In IIS 7 I cannot give web.config file for the path, it should be folder. and I have change identity in apppool to Network Service and gave readaccess permission to folder.
I have a website solution where I have among other things some code for a photo album. I know wanted to make a separate website solution with only the photoalbum code. It is however giving me some issues with not finding files, which I believe are caused by not being able to set the virtual path in the website solution. The option is simply not present in the options as you can see on the image on the right.
View 3 RepliesI've got a project that's going to go on a dedicated server environment. I'll be uploading images to the server, but saving them outside of the virtual folder path of the actual website, like so:
protected void UploadImage_Click(object sender, EventArgs e)
{
string newFile = "C:\Images\myImage.jpg";
this.cb_fuMainImage.PostedFile.SaveAs(newFile); // from webform <input id="cb_fuMainImage" type="file" runat="server" />
}
Now, this works fine on my home computer. Is there anything I'll need to do with IIS or ASP.NET (possibly in web.config) for this to work properly on a production machine? Settings or permissions that may need changing?...
It will be on Window 2003 with IIS6 and ASP.NET 3.5 SP1.
Where is the virtual path setting of the web solution stored? If you change the value, the .sln solution file isn't modified but if you change the port number the sln is modified For example, if I add another level to the virtual path, the full url to my web solution would be [URL] MyProject where /MyProject is set in the virtual path. I'm under source control. I've changed the virtual path and port to arbitrary values and run the web project. The url is [URL] I've exited the solution, deleted all the temp asp.net files, the bin files, and restored the .sln file from version control. I've opened the web solution and the port is restored to 2332 but the virtual path is still set to /whatever Is this setting stored in some strange location I'm unaware of?
View 19 RepliesHow do I load a definition file which contains some start up logic at Application_Start?
I only know the virtual path but not the server physical path. How do I convert the virtual path to server path without Server.MapPath()
I am not sure I can access httpcontext or not in the application start stage.
I have a asp.net web application and one asp appliation which are hosted on different places.now i will login to asp application. within that asp application i have a link which will open the asp.net applicaitno home page in pop up window without need of sign in again along with full security.
View 2 RepliesI have a http module at root level which resolves to the virtual directory which is a .net application on some conditions as below.
I need the have the httpmodule at root level only for some requirements.
application.Context.RewritePath("/virtualdirecotry/root/pages/sample/sample.aspx", String.Empty, "");
the sample.aspx page uses a master page as below
<%@ Page Language="C#" MasterPageFile="~/Root/Pages/Master/Site.Master"
as it uses the relative path the http module is unable to understand the path and throwing following error
The file '/Root/Pages/Master/Site.Master' does not exist.
error occurred during the parsing of a resource required to service this request. review the following specific parse error details and modify your source file appropriately.