I have deployed my ASP.net MVC site to a shared hosting company. The problem is that now none of the pages except for the home page work. For example if I go to /Account/Register I get a page not found. However, if I go to /Account/Register/Index.aspx then it does work. I have tried modifying the routing to add in that index.aspx but everything I have tried fails.
My question is: since Visual Studio 2010 was only just released, why does it not render pages in the same way as the latest Microsoft web browser, IE8?
Is there a bunch of render options I should be setting?
I thought Expression Web was supposed to help with its fancy Super Preview but that app doesn't even open VS solutions.
Thanks for any assistance, Luke
I Have several forms in my website and I have several pages with intense database activity. I want to set a cap on requests per user. For example, I don't want people to make over 10 requests in less than 10 seconds.
Is there way to do this in Django?
I want to create a webpart like below to contain fixed links to some internal pages:
The two shown in red blocks. How to create these webparts and attach to the site?
Hey,
I'm using the WebBrowser control in an ASP.NET MVC 2 app (don't judge, I'm doing it in an admin section only to be used by me), here's the code:
public static class Screenshot
{
private static string _url;
private static int _width;
private static byte[] _bytes;
public static byte[] Get(string url)
{
// This method gets a screenshot of the webpage
// rendered at its full size (height and width)
return Get(url, 50);
}
public static byte[] Get(string url, int width)
{
//set properties.
_url = url;
_width = width;
//start screen scraper.
var webBrowseThread = new Thread(new ThreadStart(TakeScreenshot));
webBrowseThread.SetApartmentState(ApartmentState.STA);
webBrowseThread.Start();
//check every second if it got the screenshot yet.
//i know, the thread sleep is terrible, but it's the secure section, don't judge...
int numChecks = 20;
for (int k = 0; k < numChecks; k++)
{
Thread.Sleep(1000);
if (_bytes != null)
{
return _bytes;
}
}
return null;
}
private static void TakeScreenshot()
{
try
{
//load the webpage into a WebBrowser control.
using (WebBrowser wb = new WebBrowser())
{
wb.ScrollBarsEnabled = false;
wb.ScriptErrorsSuppressed = true;
wb.Navigate(_url);
while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }
//set the size of the WebBrowser control.
//take Screenshot of the web pages full width.
wb.Width = wb.Document.Body.ScrollRectangle.Width;
//take Screenshot of the web pages full height.
wb.Height = wb.Document.Body.ScrollRectangle.Height;
//get a Bitmap representation of the webpage as it's rendered in the WebBrowser control.
var bitmap = new Bitmap(wb.Width, wb.Height);
wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
//resize.
var height = _width * (bitmap.Height / bitmap.Width);
var thumbnail = bitmap.GetThumbnailImage(_width, height, null, IntPtr.Zero);
//convert to byte array.
var ms = new MemoryStream();
thumbnail.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
_bytes = ms.ToArray();
}
}
catch(Exception exc)
{//TODO: why did screenshot fail?
string message = exc.Message;
}
}
This works fine for the first screenshot that I take, however if I try to take subsequent screenshots of different URL's, it saves screenshots of the first url for the new url, or sometimes it'll save the screenshot from 3 or 4 url's ago. I'm creating a new instance of WebBrowser for each screenshot and am disposing of it properly with the "using" block, any idea why it's behaving this way?
Thanks,
Justin
Using AspProviders (TableStorageMembershipProvider etc) from Microsoft WCF Azure Samples.
It is WCF Service Web Role, and in Azure Storage Explorer I can see Membership, Roles and Session tables appearing nicely when I try to connect.
But is there any exisiting code to manage Membership and Roles?
Some ASPX pages I guess, something like this for plain old ASP.NET, but more modern and Azure-tested hopefully?
Thanks,
Andres
Hey guys,
I'm almost finished developing my large project, however I would love it if I could make it so instead of having the users profile pages at: http://example.com/profile/username/USERNAME
(i'm currently using .htaccess to rewrite the GET data into forward slashes and profile(.php) being read as just 'profile' profile.php also parses the url correctly to retrieve the GET data)
But it would be some much better if I could do it so that it's like http://www.example.com/USERNAME (preferred) or http://www.USERNAME.example.com
Any ideas or resources?
Thanks,
Stefan
I have a Windows Forms WebBrowser control embedded in my application. Is there any way to get a web pages favicon using either the WebBrowser or HtmlDocument API? Even obtaining it from the local file system would suffice. Downloading the icon as a separate operation would be a last resort...
Thanks.
I want to create a webpart like below to contain fixed links to some internal pages:
The two shown in red blocks. How to create these webparts and attach to the site?
In one of my Selenium test cases, I try to ensure that certain pages can't be accessed. Instead, HTTP return code 403 should be given.
However, here Selenium terminates test execution with the following exception:
com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://user:[email protected]/admin Response_Code = 403 Error_Message = Forbidden
Any way to work around that?
Hi experts.
I have some filter and one grid.And grid have some buttons like modify/edit.I am selecting some value from filters and getting some result in grid.now i want to modify some record.when i come again on grid data in filter should be remain same.
There is two pages.
one contain filters and grid
second contain modify details.
Thanks
Pankaj Pareek.
Hello everyone,
I am using SharePoint Server 2007 with collaboration portal template on Windows Server 2008. The default search address for a site is pointed to /SearchCenter/Pages/Results.aspx. Any ideas how to change the address to some other address? Either programming solution or easy config solution is fine.
thanks in advance,
George
I'm working on a personal project to build a small web app that is built using AJAX requests and talks to a RESTful API rather than traditional HTML pages and form submissions.
Are there any online articles or tutorials or any books that people could recommend that cover design patterns for this kind of thing?
I set up a few pages with OutputCache profiles and confirmed that they are being cached by using multiple browsers and requests to retrieve the page with a timestamp which matched across all requests. When I try to enumerate the HttpContect.Cache it is always empty.
Any ideas what is going on here or where I should be going for this information instead?
Hi
Does someone know a good way to automate the gui testing based on an Asp.Net frontend? (instead of always run the pages and test the inputs and outputs of a control by hand)
Are there any references or framework to support these tests?
Thanks
I am using UIWebView in a regular Objective-C iPhone App. Web pages displayed in the UIWebView are writing to a HTML5 client-side SQL database via javascript. I would like to open this database for reading and writing from the iPhone App. Is this possible? and if so, how do I find the database and can I use the SQLite framework to open them?
I am trying to get the list of people from the http://en.wikipedia.org/wiki/Category:People_by_occupation . I have to go through all the sections and get people from each section.
How should i go about it ? Should i use a crawler and get the pages and search through those using BeautifulSoup ?
Or is there any other alternative to get the same from Wikipedia ?
For example, to access a page in my search folder, I have to write:
mywebsite.tld/search/searchJob.php
I don't want users to have to write down folder structure and whatnot. What can I do to change this?
OR, is there a better way to organize my files? Because I'm only two pages in and I decided to move some files and got lost in the heirarchy (that's why I moved them like in the picture).
I have a master page which references a style in the following manner:
<link rel="stylesheet" type="text/css" href="../../Content/Style.css" />
All my pages inherit from this master page. And this works well when the URL is http://www.domain.com/home/details/5, however the URL is http://www.domain.com/home/create, then, of course, Style.css cannot be found because `../../Content/Style.css' resolves to a directory one higher where there is nothing there.
How is this typically handled?
I have added and removed fields in my models.py file and then run manage.py syncdb. Usually I have to quit out of the shell and restart it before syncdb does anything. And then even after that, I am getting errors when trying to access the admin pages, it seems that certain new fields that I've added still don't show up in the model:
Caught an exception while rendering: no such column: mySite_book.Title
I'm writing an extension for firefox. Using dom.location to keep track of visited search results pages, i'm getting this url http://www.google.com/search?hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=642c18fb4411ca2e . If you click it, the google search results for "hi" should come up. You'll know that from the title bar - because the rest of the page won't load. This happens with any google search. Oddly enough, if you cut part of it off, so say, http://www.google.com/search?hl=en&source=hp&q=hi - it works! But Googling "hi" myself does give me a longish URL - http://www.google.com/#hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=db658cc5049dc510 . I know for a fact that the first time that URL was visited, the page loaded, I did it myself.
Can anyone make reason out of this?
I just tried my experiment again, this time saving the original URL in the location bar. It turns out, dom.location.href is giving a different value. How is this happening?
Original:
http://www.google.com/#hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=642c18fb4411ca2e
dom.location.href
http://www.google.com/search?hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=642c18fb4411ca2e
window.addEventListener("load", function() { myExtension.init(); }, false);
var myExtension = {
init: function() {
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent)
appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true);
var messagepane = document.getElementById("messagepane"); // mail
if(messagepane)
messagepane.addEventListener("load", function () { myExtension.onPageLoad(); }, true);
},
onPageLoad: function(aEvent) {
var doc = aEvent.originalTarget; // doc is document that triggered "onload" event
// do something with the loaded page.
// doc.location is a Location object (see below for a link).
// You can use it to make your code executed on certain pages only.
var url = doc.location.href;
if (url.match(/(?:p|q)(?:=)([^%]*)/)) {alert("MATCH" + url);resultsPages.push(url);} else {alert(url);
}
}
This snippet comes directly from Mozilla with the matching and alerts my own. I apologize for not posting the code earlier.
I've been looking around JQuery libraries for the URL hash, but found none that were good. There is the "history plugin", but we all know it's buggy and isn't flexible.
I am loading my pages inside a div. I'll need a way to do back/forward along with the url hashing.
mydomain.com/#home
mydomain.com/#aboutus
mydomain.com/#register
What's the best library that can handle all of this?
Hello community,
i have the following problem sometimes my openURL-Dialog works perfectly, then i looked at the variable from the url and that is the variable:
www.brehm-gmbh.de
but some other times there are some crazy elements at the end of the variable like this:
www.adamczyk-fenster.de%E2%80%8E
i get this pages from an .asc file and both are in this file normal without this elements,
what can i do to solve this problem?
thank you all for helping beforehand
does anyone know how to use jquery modal dialog in asp.net pages?
http://jqueryui.com/demos/dialog/
I've tried creating a simple aspx page, pasted code from the example (http://jqueryui.com/demos/dialog/), it almost works. The dialog briefly shows up and then disappears. It seems that the page is doing a postback. I'm not sure how to stop it, so that the modal dialog stays up.