ASP.NET (C#) do a post to page from code and go to that page - asp.net

I am very new to .NET and am now in need to modify an existing ASP.NET website done with C# long back by someone else (with .NET version 2.0).
There are lot of process involved in this website and I need to get few data from the database and then do a POST to another page from the code itself. I am able to do a redirection to required page with necessary parameters, but need to implement the same with POST.
Can anyone please guide me on how to implement this? Thank you.

After few more searches on my requirement, came across another Stackoverflow post - https://stackoverflow.com/a/2802848/2451196.
This was a much straight forward approach for me and it worked like a charm. Thanks to Pavlo Neiman (https://stackoverflow.com/users/164001/pavlo-neiman)

Related

How to redirect page from HTTP to HTTPS(IIS and Code methods)?

I was searching on web for this solutions and found so many solutions. Some of you might merge this with other question as duplicate(i dont mind), but there are some general questions i have as newbee which help me to understand this process and also other can use this. So my website works on both http(80) and https(443). I want my login and edit profile page to always redirect to HTTPS. I dont care about other pages.i binded the SSL and works fine with http and HTTPS.My application is in ASP.net and server is Windows server 2008 with IIS7
So there are two ways i found through which you can do this. 1) Through IIS and 2) Through Code (Other methods are welcome)
My first question is which option is more feasible or optimal? I saw some of the comments with IIS and MS URL redirect module says they have problem redirection in some IE. And for code based solutions i am wondering is this the best method you can use.
I saw some commets which says if you have dynamic URL then IIS method might give you error for some URL with data.
Second is pros and cons of these two methods? So other can use one of those method according their needs
here are some of the answer i got from web
http://raoulpop.com/2007/08/07/automatic-redirect-from-http-to-https/
This is IIS method
http://www.sslshopper.com/iis7-redirect-http-to-https.html
and i can go on with these solutions. But what i am asking is which is better way, ISS or code? You are welcome to post your ideas and your solutions which help me and other to understand this problem better.
Thanks in advance.
Arpan.

Crawler for Deep-Web calling ASP.NET page

Introduction
I'm developing a web-crawler and I need get the return of ASP.NET forms.
I know about the difficult to try that, but my crawler can get the return of PHP forms or languages like that. I'm using HtmlAgilityPack and call with POST parameters. That works fine.
Problem
My problem starts when I need crawler ASP.NET Forms, with a lot of hiddens fields and other the information (like __VIEWSTATE or __EVENTARGUMENT) for ASP.NET Kernel.
Question
How Can I put for my crawler send a POST call and receive the correct return with the data base filters? Somebody have information about that? Somebody tried something like that?
Thank's everybody.
I'm waiting for a good response.

How to SEO friendly an existing ASP .NET 3.5 web application under IIS6

So, I know there's a lot of this subject here and over the Internet. But most articles/questions refers to "static" url rewriting, like:
www.site.com/products.aspx?category=Books
So they rewrite it to
www.site.com/Products/Books
That's ok but I need something else.
The site is like a CMS, it has different types of content.
Nowadays to read the article titled "How StackOverflow helps you in your development" you need to go to an URL like the following.
www.site.com/viewContent.aspx?Id=1234
What I want to achive is:
www.site.com/Content/Articles/how-to-stackoverflow-helps-you-in-your-development
So as I understand, I need to involve ASP .NET in that, because first I need to retrieve the article (an its title of course) and then rewrite the URL.
But I'm wondering how the hell ASP .NET will know how to get that article if I go to that URL, it doesn't include the id anywhere...
So maybe I could accept something like
www.site.com/Content/Articles/1234/how-to-stackoverflow-helps-you-in-your-development
I'm kind of lost here really.. I've never done any URL Rewriting at all and I've googled a lot and I cannot find a way to do what I want. Maybe what I want is not called url rewriting??? I don't know...
The site is running under Windows 2003 Server, IIS6, ASP .NET 3.5 SP1
And of course, I need a free solution, cannot spend 100usd on the ISAPI mod (besides I don't know if that is going to do what I need).
Thanks to all and sorry if this is a duplicated question, but I couldn't find it.
EDIT: I don't need to support non-ASP.NET files (jpgs, gifs, etc) don't need to be rewritten. I just need to rewrite the viewContent page to include the content title into the URL.
You can use the new Routing that comes with ASP.Net 3.5 sp1 to have clean URLs.
This can even be done in web forms and not just MVC. ( I have done it myself). See here and here for exanples of how to set it up.
You can throw the Id of the article and the title in the URL and make the Id the real parameter that gets used to search for the article. That is what SO does. Try removing the question for the URL and it will take you to the same place.
Even if you don't use the Id you can pass the title of the article "how-to-stackoverflow-helps-you-in-your-development" to your DB and retreive the article based on the title.
With regards to IIS 6 it is a little trickier since IIS 6 by default can't handle extension-less URL's.
There are a few work arounds:
Use the wildcard mapping in IIS to map all requests to Asp.Net
Put Default.aspx at the end of your urls
See this post for other possible solutions.
Although the first solution may have performance issues if all content in your site goes through Asp.Net (even images, css, .html ...) in a small site it shouldn't matter. I have used this approach and there wasn't any major performance issues. I think it is the simplest solution. Here is the website I built with it
I hope this helps.
This one is free, I have used it and it works pretty well: http://www.codeplex.com/IIRF
The nice thing is that it will handle url's without an extension (i.e. .aspx, .html, etc.)
You can achieve this with ASP.NET routing.You can do this with ASP.NET MVC as well as Webforms.No need to do anything with IIS.
Check the below link
https://web.archive.org/web/20201205221404/https://www.4guysfromrolla.com/articles/051309-1.aspx#postadlink
I did URL routing in my web application within 1 hour with the details from the above link.Its quite simple to learn .They provide sample codes too.It will help you to do it easily
You can retrieve the Id of the content using the title.But title should be unique.You can use ajax to check whether the title is a already existing one when user takes mouse out from the textbox.
Easiest way is to add a http module to your current webforms project.
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
This shows you the basics of it, But it can easily be expanded so that the pages you want to rewite is taken from a database or even built on the fly.
ASP.net MVC is your friend for that
stackoverflow use MVC

How to construct expandable website structure?

HI,
I have a ASP.NET webiste I created from craft and it now look a big mess. I want to reorganize this but don't know the good way to do it. Some first look well but later cause trouble with master page, image path...
Now I'm thinking of 2 ways:
Using UrlWriter: but it seems lead to a bulk of path rewrite and usually lead to Resource not found or something
Using a page as main entry and using Server.Tranfer to pull the right page content, despite of its location
Which is better? Do you have another method?
Please help!
There's another approach, System.Web.Routing, added in ASP.NET 3.5 SP1. Basically, you implement the IRouteHandler interface and manually route the request to an appropriate handler.
This is how ASP.NET MVC handles request routing. There's a guide here that uses it for Web forms.
By the way, consider looking at ASP.NET MVC and check if it's appropriate for your situation.

Is there any Forum or Knowledge base for Plumtree interms of hosting Asp.net as Portlets

I am quite new to Plumtree, and hosting asp.net pages as portlets is not so easy.
There are weird issues coming up every time, like
-> Session variables don't work across PAges
-> Build- in Ajax doesn;t work
-> Response.redirect fails
I would like know more on hosting asp.net pages in plumtree, Please let me know if you come across any Forum or Knowledge base for Plumtree.
Your best place would be BEA/Oracle forums for Aqualogic, LiquidSomething, Interaction, or whatever they call it now.
Explaining inner-working of Plumtree here would take forever.
The best way to do this is to use the session preference in the web service definition
B
Use session preferences. More information and details can be found here: http://download.oracle.com/docs/cd/E13174_01/alui/devdoc/docs60/Portlets/Basics/PlumtreeDevDoc_Integration_Portlets_Settings.htm
Also check out http://www.function1.com/blog for Plumtree/Aqualogic Interaction/WebCenter Interaction discussion.

Resources