.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Change virtual directory?

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net

I have a few websites hosted on a 2008 server with url rewriting

I have each site in a folder:

Site 1/

Site 2/


I hide the folder using url rewriting so that the address is http://site1.com as allosed to http://site1.com/Site 1/

My problem is, when I link to a file for example:

<a href="default.aspx">Home</a>

the url resolves to:

http://site1.com/Site 1/default.aspx



Is there a setting that allows me to change the folder that the site thinks it's in?  Like a virtual directory or something?

Thanks in advance.

View Complete Post

More Related Resource Links

Difference Btw Website vs Web application and Virtual directory in IIS 7


May i know what is the Differenc that they actually make in IIS7 .

Please tell me at a low level as i am still a novice in Asp.Net


Thanks in Advance.


send credentials for virtual directory through application

Hi All,Please let me know that how to send credentials for virtual directory through application.Thanking You...

Pass virtual directory credentials through application

Hi All,We have created a website and for the secured files created a virtual directory and in virtual directory properties we selected Application-user(pass through authentication).If any user directly browse the files link then the browser prompts a screen for virtual directory credentials.Here my requirement is i need to send the virtual directory credentials through the application.Please let me know.Thanking You..

Redirecting default.aspx to root virtual directory

I have a simple ASP.NET 3.5 application running under IIS7 under a virtual directory. So the URL of my app is like http://site.com/app. I want to 301-redirect the request to site.com/app/default.aspx to site.com/app for better SEO. I have to do this redirect through code only, not by any IIS settings. I am unable to do so via code mentioned in this article:http://www.4guysfromrolla.com/articles/072810-1.aspxThe code:if (request.RawUrl.Equals("/default.aspx")) { newUrl = string.Format("{0}://{1}{2}", request.Url.Scheme, request.Url.Authority, request.RawUrl.Remove(request.RawUrl.LastIndexOf("/default.aspx", StringComparison.OrdinalIgnoreCase))); context.Response.Status = "301 moved permanently"; context.Response.AddHeader("Location", newUrl); } seems to go into an infinite loop when the application is under a virtual directory. the request.RawUrl property always returns "/default.aspx" even after a 301 redirect causing the infinite loop. How can I fix this issuhttp://forums.asp.net/AddPost.aspx?ForumID=27e?

javascript web service in different virtual directory?

Hi, I've searched far and wide, but can't find out why this is happening. I have a clientside javascript ajax call into a web service that works fine if both the service and the calling page are in the same directory. If I try to move the web service to another virtual directory, I get this: Exception type: InvalidOperationException Exception message: Request format is unrecognized for URL unexpectedly ending in '/js'. Here are the relevant code tidbits for the separate directories attempt. Thanks for any help! aspx file:<div> <form id="form1" runat="server"> <asp:ScriptManager runat="server" ID="scriptManagerId"> <Scripts> <asp:ScriptReference Path="CallYahooQuotesServiceMethods.js" /> </Scripts> <Services> <asp:ServiceReference Path="/quotesservice/YahooQuotesService.asmx" /> <--- this works if remove /quotesservice/ and service is in same dir </Services> </asp:ScriptManager> </form> </div> <div>  <input type="button" value="Client" id="Button2" onclick="GetQuotes(ticker

Virtual Directory in VS

Hello,I'm using VS to produce my website.In IIS, this website has one virtual directory mapped on another physical directory on the disk.How can I include this directory in my VS project ?Website structure://physical_dir1/physical_dir2/virtual_dirDisk structure:c:\www\root\c:\www\root\physical_dir1c:\www\root\physical_dir2c:\anotherPath\ pathToVirtualDirAs my .csproj file is in c:\www\root, VS can't "see" the virtualdirMy question is not how to create the virtual dir in IIS, it's already done and all is ok. My question is how to include this dir in my projet in VSMany thanks for your help

Authentication with a UNC Virtual Directory.

I'm using IIS7.5 and Windows Authentication through an ISA server. I'm trying to migrate a classic ASP application to ASP.net.We have an internal file server with our department folders on and I'm trying to provide web based access to these. Previously I created a UNC virtual directory to the \\server\departments share, and because ASP classic ran in the context of the authenticated user they could only browse folders they had permission to.What security settings should I now be using for the Application Pool and what settings should I use on the Virtual Directory credentials to ensure security? I'd like the ASP.net page to run in the context of the logged in user, and when the code tries to display a sub-folder they don't have access to it should 'bomb out' as before.Thanks

Map a network share to a virtual directory path @ runtime

Hi Guys Have run into an interesting issue. We have an asp.net web application - we can deploy it over the internet, the secure intranet, local offline user laptops. On of the teams in our organization has a product by which they develop static html reports from the main database. Originally we developed a module in our app which is nothing more than an iframe. Since the html files were pushed under our application virtual directory we used to use java script to set the source of iframe to http://server/app/module/fileXXX.html   Now due to some deployment procedure changes and some security issues the html reports will be deployed on another network server and exposed through a share. Also the share will not have IIS so not virtual directory. So we can no longer set the iframe source through java script to a web file.   Is there any way i can @ runtime map a folder in my application virtual to the network share so that we can browse to these web files like before (Copying the files over from the share to my Virtual Directory is not a very elegant soln.)   Thanks Regards Siddharth

MaintainScrollPositionOnPostback = true is not working in IIS 6 with virtual directory is running A

Hi All, virtual directory is running ASP.NET 2.0.50727 Environment details: IIS 6 on Win Server 2003 The virtual directory is running ASP.NET 2.0.50727 I have set maintainScrollPositionOnPostBack="True" in the page directive Any ideas? Do I need to install any service packs? also the app is not working well with firefox in some scenarios

SSRS 2008- redirect to /Reports virtual directory?

We have just configured a new SQL Server Reporting Services 2008 server. So far, everything is going well, with the exception of one thing: we want anyone who hits the root of the webserver to be redirected to the /Reports virtual directory. So, if the user enters http://servername.domain.com/ it would redirect to http://servername.domain.com/reports. In SSRS 2005, it was easy to configure IIS to do this, but with SSRS 2008, I cannot figure out how to make this change. Help?

Impact of change of the cn attibute in the Active directory

Hello, Is there an impact in SharePoint applications (MOSS 2007, with workflows, alerts, ect.) if the content of cn attribute is changed in the Active directory?  We received a note from our infrastructure team that asked us to assess the impact on our applications if they modify the cn attribute of users and groups.   For instance, my name is currently displayed as Name, FirstName - Division / Division (in French).  The new display would remove the comma and the dash.  Would I need to revisit all my SharePoint Designer workflows?    Other impacts ? thanks for any help you may provide.

i cannot access iis virtual directory using http protocol..getting status code error 403

i am trying to connect to remote exchange using powershell..while using powershell session i get status error 403...i changed the settings in iis manager...i have set all the settings in the iis manager as said in the msdn support blogs...yet i get the same error when i access it in the client url and also in powershell of the client computer...if i cannot connect using powershell,can i connect using .net???somebody help me...i am beginner and i am stuck...

Html.ActionLink displayes unwanted virtual directory routing

My hosting provider has ASP.NET 3.5 and I'm using MVC 2.0. I have two domains on my account, http://www.domain1.com, and http://www.domain2.com, each has it's own virtual directory off of the root: / /domainone /domaintwo   Their routing commands for their httpd.ini rerouts http://www.domain1.com to http://www.domain1.com/domainone   If I type in the address bar http://www.domain1/Home/About, it works properly. The Problem My website links created using Html.ActionLink add the virtual directory. If you mouse over the About link in your standard MVC2.0 webapp, it displays as follows: http://www.domain1.com/domainone/Home/AboutAll of my testing and setup on my development machine doesn't have this virtual directory, and in the past my webhost didn't have this issue in the path. But since the move to their 'new' shared hosting platform, this is now what I'm having to deal with. How do I setup my ASP.NET MVC 2.0 web application to remove the unwanted virtual directory name from the path in my ActionLink controls? For example, when I mouse over the About link, I want the path to be http://www.domain1/Home/About ..or how can I add a new route handler to strip the virtual directory path from http://www.domain1/domainone/Home/About.   When I mouse over the Log On button on my logon page, the partial url domainone/Account/Lo

create and Edit Virtual directory through c#


Hi All,

I am working in a .net C# .In my application I have to create in the
IIS>local computer>Web Sites>Default Web Site - virtual directory

and also I want to be able to
change properties of this vitrual directory (All process of creation virtual directory in the IIS I want to do programmaticaly).

I had make a program in C# for create a Virtual Directory.But i didn't able to edit its property..

After this i have to implement all this program in .Net Remoting 0r WCF.So please guide its possible and how to i make it ,Please members or seniors help me.I'll wait for reply..

Warm Regards:-
    Gourav Vishnoi
   +91-9871157845 (M)

Response.TransmitFile virtual directory?


I can use Response.TransmitFile on my p.c. using VS2008  fine. But when I moved my code over to the server it won't work. Does the path have to be a virtual directory?


Lets assume you have 1 serverA with dir D:\ExcelReports and another serverB thats the webserver. So to transfer a file you would need something like Response.TransmitFile(D:\ExcelReports) ?

Unable to create the virtual directory - VS 2010


I just migrated from xp to windows7 and also fron VS2008 to VS 2010 so please bare with me if this is a simple question.  I am trying to get settle with my new dev environement and when I create a new web project and try to run it on IIS instead of the virtual server and use the create Virtual Directory button I get the following error message:

Unable to create the vitual directory. To aceess local Web sites, you must install the following IIS components:
IIS6 Metabase and IIS 6 Configuration Compatibility ASP.NET

In Addition, you must run Visual Studio in the context of an administrator account. 

If someone could help I would appreciate.


PS: I was running VS 2010 as an administrator when I got this error

Merge replication with Web synchronization - want to move virtual directory


Configuration: W2003 server, SQL 2008 ent, SQLCE 3.5sp1 (version 3.5.8080.0)

Using merge setup wizard many moons ago I set the path for my virtual directory to a disk that is now having space problems. As you can guess, I took the default path for SQLCE under C:/Progam Files. Occasionally a subscriber has an issue and when they reinitiate a subscription for some reason a file that is twice as large as the database begins to grow under the Web sync folder. This file has an .OUT extension.

I'd like to move the virtual directory to another disk to alleviate the space problems. But with hundreds of active subscriptions I'm leery of doing this since the database size is over 1gb and we do not want to break the current subscriptions!

Can I simply move the virtual directory using a copy/paste of the files and redesignating the path in IIS?

My snapshot folder is fine and I don't need to move that. It's just this IIS virtual directory that is on the C: drive.

I know I cannot create a new Web Sync point using the Wizard since it will break the subsritptions I have out there already.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend