In Visual Studio 2015 I would like to remove site.mobile.master - asp.net

In my asp.net forms website, I would like to remove site.mobile.master from my website. I would like to use just site.master. Is this possible? I used the default settings to build the site. I don't have the skills to make a website with a login without using the default asp forms web build. This, unfortunately, makes a mobile.master and a view switcher. I want neither. Thank you for looking at this.

Yes, this is possible. Get rid of ViewSwitcher.ascx and Site.Mobile.Master from your default ASP.NET project - they are neither needed (1) nor desired (2):
(1) You only need Bootstrap to make your site responsive.
(2) These files employ user agent sniffing which is totally unreliable these days.
Once you have this done and your site compiling without them, study up on Bootstrap and integrate the Bootstrap assets into your ASP.NET project assets to get everything working. In the more up-to-date templates, Bootstrap is already being used - have you checked?
I would start reading the Bootstrap documentation.

I've had this issue as well even after removing my ViewSwitcher and Site.Mobile.Master. What solved it for me was going into the RouteConfig.cs file and removing the AutoRedirectMode line:
var settings = new FriendlyUrlSettings();
//settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings);

Related

.net 6 MVC Razor site - loginPartial links don't open the page, routing issue? How can I fix this?

Basic site from the create project wizard, I added the Identity scaffold like I have done in the past.
Added the partial to include the _LoginPartial on my template nav bar. However, the links don't open the page.
It stays on the current page and the Areas are there.
The links look default and I haven't changed them.
If I go to /Identity/Account/Login it renders a 404. Is there any special routing I need to do? I thought it does this automatically.
Have to add app.MapRazorPages(); to the Program.cs
The app is not smart enough to add when adding the Identity scaffold to the application.

ASP.NET - Mobile Site Master

As part of my university project, I had to develop a front end website with HTML5 and make it responsive. Then for the back end programming, I had to continue with ASP.NET. After configuring everything, all seems to be working fine except when I switch to responsive mode (via inspect) and no button is working because of the unconfigured Site.Master.Mobile (I haven't touched a thing there) - What should I implement there? Should I paste the original Site.Master code there or what?
Get rid of ViewSwitcher.ascx and Site.Mobile.Master from your default ASP.NET project - they are neither needed (1) nor desired (2):
(1) You only need Bootstrap to make your site responsive.
(2) These files employ user agent sniffing which is totally unreliable these days.
Once you have this done and your site compiling without them, study up on Bootstrap and integrate the Bootstrap assets into your ASP.NET project assets to get everything working. Learn to merge common Bootstrap assets into your master pages and regular pages in an intuitive manner.
I would start reading the Bootstrap documentation. Use version 3 of Bootstrap - version 4 is still in aplha.

add new page to existing website without modifying the rest of the website

i have to add one page to an existing asp.net webforms website.
this will be added at runtime and i'm not allowed to redeploy the entire webapplication / website.
is the (recommended or only) solution to move the code behind code to the aspx file, or do i have other options?
i can't put code in the dll's, and dynamicly runned .cs files are only in the case of a website and not in the case of a webapplication, am i right?
and putting the code from my code behind in de aspx file will always work?
actually as long as their page link to yours via URL you web page doesn't necessary have to be in the same project, unless you're trying to reuse something.
Else technically your project is fine as a standalone and they can just link to yours.
Unless you're worried about the URL then you would have to either use an iframe or some other URL rewrite.
Just for reference: One solution would be to use a dynamic proxy and intercept and extend the existing webapp. Though this approach might be a little too involved for what you're trying to achieve.
LinFu
Castle

Changing the Default browser to debug in an ASP.NET MVC 2 Project

I just created my first MVC2 project using the standard template. I need to be able to change the default browser for my project to test in IE (I use chrome as the default on my OS).
Unfortunately, the right click on default.aspx suggestion which worked in MVC1 can't work with these new projects as they don't have that file.
I was able to click on the Default.aspx (this is a MVC2 project) file and choose any of the browsers installed in my system. Are you sure it's not working for you?
If for some reason you don't have Default.aspx you can also add one, can you not?
If not, you can add a static .html page and use that as well.

Put ASP.NET on wordpress site

I work for a college and our main website has an ASP.NET based course information search which I created. This has become popular and our company facing website (training for companies) has asked for the same system on their website. I'm not involved in the day to day of either website but know theirs was made using Wordpress. Is it going to be possible for me to embed some ASP.NET code within some of the pages? Any articles on doing this?
EDIT:
The ASP.NET code that would appear in the actual Markup is minimal it's mainly a few asp:Literals I did this on purpose to hide most of it from the website developer to save myself hassle when something gets deleted by accident.
EDIT2 There was a response to do it as a webservice would this be possible. i.e. as search box on the main page displaying the results underneath.
Since asking this question a long time ago and creating a less than ideal iframe solution I have now found a great wordpress plugin called iframe-less
http://wordpress.org/extend/plugins/iframe-less-plugin/
Basically you give it an URL and it builds the content of that page directly into your wordpress page. So far it seems to work really well.
I have similar needs that the originator of this thread has. I maintain a CRM and corporate site that runs on ASP.NET/SQL along with a separate Wordpress php company blog. After we've been using Wordpress for a year, people here would love to be able to edit static content on our corporate site like we do in Wordpress, so I am looking at possible ASP.NET/Wordpress hybrid set ups.
I am hearing good things about "Phalanger": http://www.php-compiler.net
It is a PHP Language Compiler for the .NET Framework, and you can run PHP code in .NET
It was also great to find out in this thread that you can have PHP and ASP.NET in the same IIS web, its another reasonable sounding solution. If I had any nay reputation (I am new here) I'd give RickNZ a vote.
What you could do is create a web service on your ASP.NET application and then write a Wordpress plugin, that would read that service and display it in wordpress page.
This wasn't ideal but the solution I produced involved using IFrames which are still in the HTML 5 spec (infact they have some new attributes) so I think I am ok. Basically I make a page in wordpress with an IFrame and some javascript on its onload to make the iframe resize automatically based on the content size using the code below (iframe called frame with width 100 percent).
function autoIframe(){
try
{
var page_height = document.getElementById('frame').contentWindow.document.body.scrollHeight;
document.getElementById('frame').height = page_height+60;
}
catch (err)
{
window.status = err.message;
}
}
This code will resize on loading of the first content, if the content changes it will need to be called in someway. My solution was to call the method from the innerpage using parent.autoIFrame() each time a search was done.
p.s. The javascript will only work if the iframe and outer page are from the same domain (No cross site scripting).
Wordpress uses PHP and MySql. I have successfully installed and run it under Windows 2008 with IIS 7. The new CGI stuff in IIS 7 results in pretty good performance, too.
You can of course run a separate but related ASP.NET-based site on the same server.
You can also run a mixed ASP.NET + PHP site. IIS directs incoming requests to a particular HttpHandler based on the extension of the URL, so there's no reason why you can't mix *.php & *.aspx.
In fact, you can also do things like write a .NET-based HttpModule that integrates with a PHP/IIS site, to do things like logging, centralized cookie management, HTTP header "adjusting", etc.
If you want to put ASP.NET controls in a *.php file, that's a different thing entirely. To do that, you would need to write an HttpHandler that understood how to parse such a file. Either that, or just use iframes....
Short answer: no, not easily. Wordpress is PHP - you can't just put some .net code on a PHP page.
Long answer: yes, if... if you are really keen to do this, and it's worth the time and effort, you can work around it by using some of the strategies suggested already, e.g.: host the ASP.NET bit on a windows server (or use mono) and show it inside an iframe on the wordpress page.
Just bare in mind that this is not a common setup, and may be more difficult than simply creating or using some kind of Wordpress plugin.
I am exploring http://sourceforge.net/projects/wordpressnet/ if it helps anyone ...
Also,
http://wpdotnet.com/ (related article : http://www.php-compiler.net/blog/2011/wordpress-on-net-4-0)
http://wordpress.org/support/topic/installing-to-a-net-server
I know it is an old post and I too do not prefer necroposting but
these resources may improve the existing content.
WordPress is a LAMP(Linux Apache MySQL PHP) application, and normally running in Linux servers. I don't think you can integrate ASP.Net to wordpress. But off course you can provide link to ASP.Net application from WordPress.
No, this won't work. You cannot use ASP.NET on pages that are served by WordPress. You can use ASP.NET in the same web site as Wordpress, for example by having certain directories or certain pages serve ASP.NET content, while the rest of the site still serves WordPress content.
However, if the ASP.NET code you wish to use is very simple, why not do it in PHP instead? WordPress uses PHP, which is very similar to ASP.NET.
I can be able to use both Asp.Net and Wordpress on my Host (Dinamo.net.tr)
without using any plugin or iframe.
They can really work together,
you just upload your Asp.Net C# files,
and install Wordpress at the same time.

Resources