ASPX extension not showing when browsing site from VS2013 IDE - webforms

i have created a web site with VS2013 IDE and my .net framework version is 4.5.
i select default webform template with no authentication and IDE generate project with many code and aspx file.
when i run my code from IDE then aspx extension is not showing. i comment this code in RouteConfig.cs file
//var settings = new FriendlyUrlSettings();
//settings.AutoRedirectMode = RedirectMode.Permanent;
//routes.EnableFriendlyUrls(settings);
but still aspx extension is not showing. so tell me what i need to change as a result aspx extension should be shown.

Doing that is enough to remove friendly URLs for me, you do also have to edit your Site.Master etc to change the links from ~/About to ~/About.aspx for example.
Otherwise, check for other URL rewriting as described in Scott Gu's blog: https://weblogs.asp.net/scottgu/tip-trick-url-rewriting-with-asp-net

Related

The type or namespace name 'DotNetNuke' could not be found

I built a custom theme for DNN several months ago using the Christoc templates for Visual Studio. I needed to make a small HTML adjustment today so I re-opened the solution and made the change but when I rebuilt the project, I get several build errors, presumably because it no longer recognizes my DNN dll:
The type or namespace name 'DotNetNuke' could not be found (are you missing a using directive or an assembly reference?)
I checked my C:\path_to\dnndev.me\bin\DotNetNuke.dll and it's still there so I'm not sure why Visual Studio isn't seeing it.
When I built the skin originally, I was running DNN 9.1.1 but have since upgraded to 9.3.2. Could that be causing my issue?
I read elsewhere that I could be building on the incorrect version of .NET framework but I don't know what version to use for DNN 9.3.2 so I tried several different version with no change in results.
How can I solve this issue?
UPDATE:
Per the answer here, I rebuilt with .NET 4.7.2 and it did not solve my issue.
UPDATE 2:
Okay, so the small change I made was adding another layout page like the Home.ascx and Edit.ascx files that come with the template. If I remove the new layout files, the project builds fine.
What could I be doing wrong when adding a new layout?
What you read about the .Net framework version is correct. You need to 4.7.2.
The problem was a new layout I had created. I right clicked on the project and selected Add > New Item and chose Web Forms User Control. This was the wrong way to add a new layout.
I successfully added it by copy/pasting one of the template's pre-existing layouts and renaming it. The project builds fine now.
Ah, now I understand what went wrong. Adding a Web (Forms) User Control is not completely wrong, as a skin (or theme) is a kind of Web User Control, and has the same extension (.ascx).
What you have to do is deleting the code behind file (.ascx.vb or .ascx.cs), and change the first line of the ascx file to
<%# Control language="vb" AutoEventWireup="false" Explicit="True" Inherits="DotNetNuke.UI.Skins.Skin" %>
(But copying another skin file is also a good solution as propably you have most of the references to the skin object already there)

Images not loading through CSS on IIS7.5 MVC4

My web app(MVC4) is hosted on IIS 7.5, Windows 7 Ultimate with .net framework 4.0 and 4.5 installed. On hosting the application, the images are not rendered, giving me a 404 error
The content type is "Text/html" shouldn't it show as "image/jpeg or png"?
On giving the image path directly, the image is rendered, but not through css. The css is loading, as my layout is intact.
I have gone through many questions related to the same issue, have included
<modules runAllManagedModulesForAllRequests="true" />
checked for Static Content under IIS>WWW Services in
control Panel, applied hotfixes (http://support.microsoft.com/kb/980368).. in vain.
My css code is as below,
body{background:url(images/bg.jpg);
image folder structure is
ABC
images (folder)
bg.jpg
main.css
(have tried giving the image path along with .. and /, no use)
ExtensionlessUrlHandler, are present in the webconfig, hosted on .net framework 4.0 (integrated),
My IIS also co-hosts MVC3 application, which runs fine.
Not sure what is the issue? I am missing something, which hasn't been tried yet, your help would give me some sleep.
Update:
Refering to this post
I changed the bundle according to the answer by Calgary Coder, the image is loading now.
As per this post,
I changed my bundle (as per below format/pattern)
bundles.Add(new StyleBundle("~/Content/css/jquery-ui/bundle")
.Include("~/Content/css/jquery-ui/*.css"));
And the images are loading now. Thanks to Calgary Coder.

References for MVC extension methods differ between vbhtml and cshtml files?

I am converting the login views of an application from vbhtml to cshtml. In the vbhtml files the original developer calls an Html.LabelWithAttributesFor extension method. When I write the same line of code in the new cshtml file the extension method isn't available via Intellisense and fails to compile. Are references not shared between vbhtml and cshtml files in a project?
Wanted to circle back and close this question with the "answer". In the end, what seems to have knocked something loose was when we removed the vbhtml pages from the solution. All use of the Extensions had been removed prior to our removing the vbhtml pages and other developers had worked on the solution in the interim making other changes. Fast forward a few months to another developer needing the extensions. He added a reference to the project with the extension methods and used them on a new cshtml page, which worked fine. So, the problem is solved but I still have no idea what caused the problem in the first place and I have been unable to reproduce it.

Global.asax.cs is not visible at the server

Running under Server08 | IIS7. I have a website project and am in the habit of hand editing the Global.asax.cs at the deployed site many times in the past. Recently I've found that only the Global.asax is present and has only:
<%# Application Codebehind="Global.asax.cs" Inherits="myDomain.MvcApplication" Language="C#" %>
There are simply no Global.asax.cs files present/visible for any of my active, functioning websites anymore.
I've checked here Global.asax can't find code-behind class and here where is the codes in Global.asax in mvc3? without getting anywhere. The second link contains the comment: 'That's because it's a compiled web application. You'll have to view it in Visual Studio as a project.'
But since my project has always been a website - and I've not converted it (intentionally) I'm puzzled by the changed behavior.
But when i step into VS12 and look at the context menu for the solution's WebProject it presents 'Convert to Web Application'. The sites' folder structures do not contain App_Data or App_Start. To my mind, these 2 fact establish at VS is treating the project as a website, why then, is the Global.cs compiled down to the /bin?
I'll close by repeating - I've hand edited these things in the past - I'm not positive but it's probably accurate to say that this is the first time I've tried to do so after installing VS12. And, coming to think on it harder - it's only recently that I've implemented the 'One Click Publishing' service so that could be coming into play.
verify? I'd like I need to edit a simple update without full re-deployment.
thx
I think the 'One Click Publishing' is most likely the culprit here. I created a sample Web Site project to experiment, and when I use the publish feature in Visual Studio, the files generated are indeed missing the Global.asax.cs file. Instead, a bin folder is created with a compilation called "App_global.asax.dll" even though it is a Web Site and not a Web Application. I am guessing this might be similar to what is happening for you as well.
If not, I found a link which might be useful to you in order to once again be able to edit a class on the server. Particularly, have a look at the second answer (the one not accepted as the best answer) to recreate a class file for the global code: Where is the Global.asax.cs file?
I tried this solution, and verified that the class file is editable on the server, and that it is dynamically compiled at run time (the modifications I made to the file worked immediately).
Hope this helps!
After editing the global.asax you need to rebuild and upload the DLL to the bin folder. Otherwise, your changes will not take effect.
You might be able to upload an web version of the global.asax that includes the code in that one file, which obviously does not require a .cs code behind. I used to do it with aspx files in an application but I have never tried it in the GLobal.asax file.

How to change a theme in MVC4

It seemed like I can download jquery theme I like from jquery site to create new theme. But that does not change much in my MVC site. Can anybody tell me how I can change theme in MVC4 application?
As I understand your question:
How can I replace the base theme in a MVC4 application with a custom generated theme from the jquery ui theme roller?
My steps for my razor MVC4 visual studio 2012 application created from some MS standard template for intranet application. jQueryUI already was installed in my application with the base theme from nuget.
Created the theme using http://jqueryui.com/themeroller/ and downloaded the zip to some temp folder
Extracted the jquery-ui-1.10.3.custom.js into my Scripts folder
Edited my RegisterBundles method in the file App_Start/Bundle.Config
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include("~/Scripts/jquery-ui-1.10.1.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include("~/Scripts/jquery-ui-1.10.3.custom.js"));
Extracted the css subfolder named for my custom theme (e.g. my-theme) into the themes folder "Content/themes/my-theme".
Comment out the base theme lines in App_Start BundleConfig.cs and replaced the big base theme StyleBundle with the single-file bundle
bundles.Add(new StyleBundle("~/Content/themes/my-theme/css").Include(
"~/Content/themes/my-theme/jquery-ui-1.10.3.custom.css"));
//bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
// "~/Content/themes/base/jquery.ui.core.css",
// "~/Content/themes/base/jquery.ui.resizable.css",
// ...
Finally replaced the base-theme bundle call in my layout.cshtml with the new one.
#Styles.Render("~/Content/themes/kjr-theme/css")
#Styles.Render("~/Content/themes/base/css")
If there is a better or cleaner way to replace the theme in MVC4 applications, please let me know!
Michael
Since jquery ui version was changed, jquery ui scripts in MVC4 template seem to be not compatible with current version of jquery ui. So you can't just copy css directory of downloaded jquery ui to your theme folder of MVC4, and expect it would be applied for your site.
So what I did was to replace jquery.ui.theme.css with corresponding part in jquery.ui.custom.css. And new theme was correctly shown in my MVC4 site now.
Code Project site uses an implementation of Chris Pietschmann
Code Project:
http://www.codeproject.com/Articles/32847/ASP-NET-MVC-Dynamic-Themes

Resources