Url rewrite querstring getting appended after postback event in iis 7 - url-rewriting

i have a problem with URL rewrite module with iis 7.5.
I have made friendly urls which formats the querstrings in the friendly url formats like
http:domain.com/Blog/Category-2/Welcome-to-your-Blog
Everything is working fine. but on asp.net postback event its again appending the querystrinng as mentioned below
http://domain.com/Blog/Category-2/Welcome-to-your-Blog?Category=Category-2&post=Welcome-to-your-Blog!
but i don't want this to happen in url.
please help how i can avoid this. from appending the querstrings.

Related

How to load an entire HTML page from one website into another

I have been working on a website www.xyz.com which is hosted on some server. I have been loading forms & contents from www.abc.com using I Frame which is hosted on Azure. We have now decided not to use I Frames and to load the content from www.abc.com using Jquery AJAX. Now the abc.com is providing me the UI page fragment for my forms and contents from Azure blob storage in form of .html file or .txt file. If i try to do a normal AJAX call for the HTML or TXT file path, i can the see the content coming in the Response tab of that URL but the code does not enters the Success template and hence i am unable to modify or access the content.
Please suggest
You can use Application Request Routing (ARR) for this. This is a module you can install in IIS which also works in Windows Azure.
The following image illustrates how ARR works. An incoming request is intercepted and based on a set of rules the request is forwarded (for you this will be to xyz.com) and the response is the served back to the user. Even though this illustration explains the principle with sub directories, it can also be applied on the full site.

Handle hashbang (#!) in asp.net mvc3(Routing)

I am developing single page application using hashbangs(#!)
So the application urls are in format #!/api/generalelections.
When i directly enter this url in browser the mvc does not seem to recognize hashbangs ,it always take me to default action mentiond in glolab.asax.
Could anyone provide me solution to handle this problem to redirect to proper action which is api/generalelections
Everything that goes after # is treated by browser as anchor tag and will not be supplied to the server.
In your Xhr requests to the server you should use 'normal' uris, but not your navigation ones.

Wordpress Ajax deeplink gives 404

Hi Folks,
my first post here, thanks for any help i got already throught reading before.
I am working on a wordpress projekt. And it seems i am missing the overview on my problem.
I use ajax to recieve additional product data. http:url/product/additional_ajax_data...
This works fine, except direct call of the ajax urls. Direct call of a ajax url gives
a 404 not found.
Please dont give instructions like: add 200 ok to header... Cause the project will
consist of some thousand pages and work arounds like this are a no go...
Aditional infos: the urls have no ajax hash tag... And the content will dynamicly loaded depending on last url fragment
I found the solution:
To prevent Wordpress of 404 when calling a ajax url directly, add rewrite endpoints to the system.
You can follow the post from Jon Cave on Wordpress:
http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/
Works also on custom post_types and custom taxonomys, keep an eye on the type for wich you want to register a custom endpoint rewrite (that may depends on your options from your post type, page type etc...).
If you are sure that url is correct and file is there, check if permissions on file are not too strict. Also check .htaccess to make sure it doesn't black certain file extensions to be loaded directly

How to get Orbeon Forms embedded into an ASP.Net MVC3 app?

Background
I'm investigating the use of Orbeon Forms to integrate into our
ASP.NET MVC3 web app by building a simple MVC3 app to figure stuff
out.
I have a Win2008 R2 std server running Tomcat 7 and Orbeon 3.9.1 PE
trial on our HyperV server. This is working and I can create forms and
then use the forms to submit data.
I've created an empty MVC3 app on my local dev machine. It has an
Index action on the Home controller that returns a page that has a
bunch of links to the add new URLs of some of my forms on the Orbeon
installation. The links access an Add action on the Home controller
which uses a WebRequest object with the ?orebeon-embeddable=true
querystring parameter tagged on the end to get the definition of the
Orbeon submit form page. I replace the relative URLs in what I get
back to make them absolute. I then insert that into a basic view and
display it.
Problems
HOWEVER! As soon as I do interact with the Orbeon form in anyway, e.g. click inside a single line textbox field (IE9) I get a JS error
in the script file "orbeon-[random guid style value].js" line 121 with
the line "AjaxServer.exceptionWhenTalkingToServer(e,formID)"
highlighted with the error being "formID is undefined".
I'm not sure where to start looking here as I am unfamiliar with
Tomcat and only know what I can decipher from the Orbeon docs.
Anybody tried to embed the form runner like this and experience this
error?
What I tried next
[Update]: The MVC Json() method got me thinking that perhaps the
Orbeon test site I set up on the VM did not like the fact it was
getting AJAX requests from the MVC app on my dev machine. With this in
mind I tried installing the CORS filter into the Orbeon app from
dzhuvinov.com. According to the docs after adding the relevant
config to the web.xml file the default behaviour is to pretty
unrestrictive, i.e. it should let everything through. Unfortunately
after restrating Tomcat this didn't help.
[Update 2]: Okay seems like the CORS docs are a bit out of date and
the defaults are seemingly the opposite so setting the initial values
for that seems to sort that out somewhat - although IE9 still gets the
JS error message. Meanwhile in FireFox 12 things are going better but
now the issue is how to pass the JSESSIONID cookie Orbeon sends me
back when I embed the runner in the MVC view such that when you
trigger any of the AJAX on the Orbeon form it sends the JSESSIONID
cookie as well.
Well I guess my title and info were slightly misleading so I may as well close my own question with the follow "answer".
In order to embed in an MVC3 app (read as any non-Java backend I would imagine) Orbeon Forms Runner and have it work I had to do the following:
Configure the CORS filter for my install of Orbeon Forms on Tomcat 7 (Dzhuvinov.com) to allow cross-domain AJAX.
In HTML partial's returned from Orbeon make relative URLs beginning /orbeon/xforms-server/ absolute calls to a custom proxy. Store the JSESSIONID in the ASP.NET MVC Session object.
Write controller actions for the proxy to handle requests. This simple proxy forward requests on to the Orbeon Forms install after setting the JSESSIONID cookie with the value stored in (2).

How to get a default html page on MVC3 site

I have added an MVC3 web application to an existing website that consists of plain old html files. This works great when you request a specific file but what didn't occur to me was that by changing the site to use .Net 4 it no longer took any notice of the default documents setting in IIS (IIS 6 in this case). So for example I can request www.something.com/index.html but if I request www.something.com I get a resource not found error page. Is there a MapRoute in Global.asax I can specify to map the site route url to index.html?
Looks like something has changed, I had to do
routes.IgnoreRoute("");
ASP.NET complained about the route starting with "/"
routes.IgnoreRoute("");
Allows the request to fall through to the default documents defined in the site configuration. I only have a single controller and route in this project that I use for ajax requests from the client. I want the rest of the site to continue to behave as it did when it was just plain html. With routes.IgnoreRoute("") the MVC3 app ignores the request which allows IIS to return the default document. Thanks all for your suggestions.
in global.asax you can try to define a rules like this one
routes.MapRoute("", "index.html", new { controller = "Home", action = "Index" });
But I'm afraid that with IIS 6 you have to handle the Wild card mapping.
That's normal. IIS 6.0 does not support extensionless urls. You will need a wildcard mapping as explained by Phil Haack.

Resources