![]() |
|
[C#] ASP.NET C# Web Form - Subfolder becomse Home Page root / - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] ASP.NET C# Web Form - Subfolder becomse Home Page root / (/showthread.php?tid=5890562) |
ASP.NET C# Web Form - Subfolder becomse Home Page root / - n31ght0 - Oct 1, 2018 I have project file that has subfolder for their main page. when run with visual studio the url will come like this: localhost:port/website/production/login.aspx i want to make it as root / without sub uri or *.aspx so just like this: http://localhost:port/ How to do that? i have tried using this on web.config file: Code <defaultDocument>adding "clear" and add value without "~/" make it working so i don't need to apply url rewriting or routing as it's only working on IIS and hard to me to try in visual studio because of less example on google. The problem is it load as what i want http://localhost:port/ but the CSS style and Javascript isn't load correctly may be because its on sub folder while web.config outside that folder make it read the CSS file on the place where web.config RE: ASP.NET C# Web Form - Subfolder becomse Home Page root / - itcorp - Oct 4, 2018 (Oct 1, 2018 03:23 AM)n31ght0 Wrote: I have project file that has subfolder for their main page. when run with visual studio the url will come like this: You can make custom route.In the global.asax file you can make RouteCollection and solve the problem by custom routes. add a reference System.Web.Routing; Code protected void Application_Start(object sender, EventArgs e)The second solution would be your main page rename from login.aspx to Default.aspx or in IIS Manager set login.aspx to be default main page. As for loading of css and js it's good practice to use ResolveUrl to reslove path especially if the master page and the created page by selected master page are not in the same place(dir) because he always gives you the root of virtual directory. Code <%: Page.ResolveUrl("~/Content/your.css") %>I hope this will help you,good luck RE: ASP.NET C# Web Form - Subfolder becomse Home Page root / - n31ght0 - Oct 5, 2018 (Oct 4, 2018 07:11 AM)itcorp Wrote: You can make custom route.In the global.asax file you can make RouteCollection and solve the problem by custom routes. Thanks for the kind reply mate the real savior of the web is user like you appreciate 🤝 RE: ASP.NET C# Web Form - Subfolder becomse Home Page root / - itcorp - Oct 6, 2018 (Oct 5, 2018 04:26 PM)n31ght0 Wrote: Thanks for the kind reply mate You're welcome,we are here to help if we can. |