I've done some googling on this and i know a question similar to this has been asked several times, but so far I'm not having any luck.
I've got the home page on our site also set up to be the 404/410 error page. When I do a server.transfer to this page the search form on the page no longer works. Response.redirect to this page and it works fine.
So in my code the page doing the server transfer has
Server.Transfer("/default.aspx?status=410", false);
When i then use the search form on default.aspx after getting there from the transfer, i get the error in the title.
I also see that the action value on the form has a value, whereas normally it should be blank. I saw another post suggesting setting this value manually in my content page, but I would have to hardcode the ID for the form and I'm not sure if that would cause issues on other pages since this form is used by all the pages on the site since this master page is the main master page for the whole site. Plus even when i did hard code the ID and then used Page.Master.Findcontrol to get the form and set Action = "" it still had a value set for action instead of an empty string.
I had thought as long as I didn't use Server.Transfer("", true) I shouldn't get this error. And i do have a machineKey entry in my web.config
Anyone have any suggestions on how to resolve this?
Thanks
Server.Transfer()
and Response.Redirect()
both are performing same functionality like help to navigate user from one page to another, but internal process happening inside system little bit different. To get more idea about that please visit
http://www.dotnet-tricks.com/Tutorial/csharp/c4SE281212-Difference-between-Response.Redirect-and-Server.Transfer.html
I think i found a solution, although I'd appreciate some feedback to explain something.
On the page that's being transferred to (default.aspx) I tried using Form.Action = "" and when i loaded the page that resulted in the action being something like action="/../../../default.aspx"
Just now i tried it again but I used Form.Action = "/", which did set the action to "/" and that seems to work.
So i guess my question is why did trying to set the action to "" result in that relative url?
And is this the correct way to handle this problem?
Thanks
Related
I'm using Geckofx 33.0.9.0 in my C# application, and I'm having a problem with navigating.
Generally it works well, I enter a URL and it takes me to a page. The problem is that if I enter a URL for a page that doesn't exist, it gives me a MessageBox titled 'Alert'.
1) This is really annoying. At least in my Opinion
2) I would really like to set it up, so if I navigate to a page that doesn't exist, it creates a google search from my url, like in most proper browsers.
I tried looking but Gecko isn'T really well documented, or at least I couldn't find it (Though if someone has documentation for it, that would be great!) and I couldn't find any other way of navigating other then the .Navigate('String Url/Uri') method.
What can I do to circumvent this Alert box? Is there a way?
I'm creating the GeckoWebBrowser Control in code btw.
I will of course post code if required.
to supress the alert message box you can try the following
Xpcom.Initialize(Paths.XulRunner);
GeckoPreferences.User["browser.xul.error_pages.enabled"] = false;
GeckoPreferences.User["browser.download.manager.showAlertOnComplete"] = false;
GeckoPreferences.User["security.warn_viewing_mixed"] = false;
GeckoPreferences.User["privacy.popups.showBrowserMessage"] = false;
As for the second idea, well, that shouldn't be very hard - you just need to check in the DocumentCompleted or NavigationFinished event for a page status - if it's not correctly loaded, then take the address string bit and redirect to google url + your string.
Hope this helps!
I wanted to redirect (by code) to another ASPX page and on that page I wanted to select the appropriate view (in a multi-view and during page load).
My solution was to add a url parameter that was checked on the "OnLoadComplete" event and take appropriate action, but it seems that this url parameter gets copied to all the links on the page. So, the user cannot navigate anywhere else because always this view gets presented.
My second thought was to use a Session variable, but I am afraid that this will be an overkill.
Any ideas/thoughts/suggestions on this matter?
Can I prevent the use of the url parameter in all the page-links?
Is it bad if I use a Session variable for this temporarily?
Is there some other way to do this?
i am using two .aspx pages in my application. Second page implements a dropdownlist which is binded with the database using collection. now i want to redirect from second page to my first page. i used
Response.Redirect("~/Admin/Home.aspx");
but its throwing an exception which follows like this
System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$DropDownList1="").
I want to resolve this exception. Any new ideas regarding this problem are expected.
Thanks in advance
I suspect you've misidentified the location of where your error is being thrown. It's not in the redirection itself, it's in the PostBack that calls it.
The actual answer to your problem can be found at A potentially dangerous Request.Form value was detected from the client (textboxError="<Responses><Response..."); you will need the validateRequest that the other answers mention, but you also need to set requestValidationMode="2.0" in web.config.
There's some text in your dropdown that ASP.NET considers dangerous. Either change it (it's probably some possibly dangerous character like '; etc.)
Or, at the top of the page in the page declaration add 'EnableEventValidation=false'
There are security concerns with turning this off though so best read up on it first.
set
validateRequest="false"
I hope this will help you.
Can a GET request cause IsPostBAck to be true ?
I never tried it but I read that it (somewhere) that it can be done If I add _ViewState , _EventValidation and form params.
It it true ? Can this cause a PostBack ?
Thanks.
edit
I found it here
here
edit 2 after testing - it does WORKING
I didnt't find even one topic about this in the web.
here it is :
http://imageshack.us/f/688/croppercapture1q.gif/
I make a new answer after the update of the question. Actually I make a working example, and I confirm the question, that is can be done !
http://www.planethost.gr/SOPostBackTest.rar
What I do:
I make an aspx page, render it, then get and make an html with the render page, and just change the method from post to get
<form name="form1" method="get" action="PostBackTest.aspx" id="form1">
then I open the html page, and make a get to the aspx page ! and the aspx page is actually see it as IsPostBack.
The results is surprise me. The Flag IsPostBack is set to TRUE, you can see and test it by your self. I do not know how to consider this - BUG, or feature that asp.net work so good that what ever you send them on the form is make it work.
And yes the Request.HttpMethod can show more accurate if is GET or POST command.
I have a shared user control. This UC is in one page and everything works fine. In the second page, the RadTextBox client-API get_value() method reports "", when it has a legitimate value. There is very little javascript on that page, and it's not targeting textboxes; it's in a page with 6 tabs. The controls work fine; I have RadCombo's and the drop downs work as you would expect. But no text, no selected value, nothing is being reported (I have a script to check if the page is an empty form). How do I even debug this to figure out what is going on, and why the value isn't being reported?
Thanks.
My advice is to start with debugging your js code and see whether the telerik inputs' client objects are valid in your context. If so, rhe methods from their client API should return the values set from the end user.
It was a duplicate method name in a user control,copied twice, so that's why it was bombing. Thanks.