How To Find Which Anchor Has Been Clicked For Download In Destination Page With Out Using Query String
Dec 24, 2010
I am having a web form initially which have href as follows
<a href="downloadInfo.aspx">ACH File Management System Trail(msi)</a>
<a href="downloadInfo.aspx">ACH File Management System Trail(zip)</a>
These are my two anchor tags when i click on this i will redirect both to a same page where user has to fill details and a mail will be send to the user for the given mail id. When the user clicks on mail i would like to have the download for which he opted to download. If msi means i would like to prompt msi file to be downloaded and if zip it should be downloaded I need this to be worked with out using query-string
I'm trying to implement URL Rewriting into my existing application and have managed to get the page and links working except that my destination page does not get the query string values.Mycde is based on the example below: http://dotnetguts.blogspot.com/2008/07/url-rewriting-with-urlrewriternet.htmlBasically I have a default.aspx page with links to another page; directory_item.aspx?Item_Id=1&Category_Id=1 directory_item.aspx?Item_Id=2&Category_Id=1 and so on... The code in my web config is as follows;
I have a page signup.aspx where user can register, how this page will find from which page request came from and how it will redirect user after registration to the requesting page, i want to do this using query string but don't know how PLZ SHOW ME CODES.
I have a page signup.aspx where user can register, how this page will find from which page request came from and how it will redirect user after registration to the requesting page, i want to do this using query string but don't know how SHOW ME CODES.
I have a few linkbuttons that each open the save dialog to let users save file to the local machine. But after any link is clicked the page is dead afterwards (nothing works) and page has to be refreshed.
So do I have to force refresh after download is complete or does it have to do something with postback?
I am trying to render a simple hyperlink that links to a named anchor within the page, for example:
<a href="#namedAnchor">scroll to down</a> <a name="namedAnchor">down</a>
The problem is that when I use an ASP.NET control like asp:HyperLink or HtmlAnchor, the href="#namedAnchor" is rendered as href="controls/#namedAnchor" (where controls is the subdirectory where the user control containing the anchor is). Here is the code for the control, using two types of anchor controls, which both have the same problem:
[code]....
I am using the HtmlAnchor or HyperLink class because I want to make changes to other attributes in the code behind. I do not want to introduce a custom web control for this requirement, as the requirement I'm pursuing is not that important enough to justify abandoning the traditional ASP.NET link controls. It seems like I should be able to use the ASP.NET link controls to generate the desired link.
i'm trying to find all the anchor tags and appending the href value with a variable. for example
<a href="/page.aspx">link</a> will become <a href="/page.aspx?id=2"> <A hRef='http://www.google.com'><img src='pic.jpg'></a> will become <A hRef='http://www.google.com?id=2'><img src='pic.jpg'></a>
I'm able to match all the anchor tags and href values using regex, then i manually replace the values using string.replace, however i dont think its the efficient way to do this.Is there a solution where i can use something like regex.replace(html,newurlvalue)
I have a Sidemenu item in my ASP.NET application like below. There are two types of users in my application (Associates, Managers).When ever Associate Login then I have to disable Manager link. I am not able find visible property in codebehind since it is a HTML control. So need your support how to handle this
Code: function excelGrid(strId, blnDoReader) { var wesPC = $("#" + strId); var objWebParam = {}; var arrGrid = [];
[Code] ....
I am modifying this now - passing in the variable strWebParam which is the "stringified" version of a JSON array. And then in the function below I am trying to get the JSON-string into the POST. I tried the INPUT/TYPE=HIDDEN method you see below - but that did not work (cut off the string - it's got quotes in it)
Code: $.downloadExcel = function(url, data, source, method, callback) { var inputs = ''; var iframeX; var downloadInterval; if (url && data) {
[Code] ....
When I do a regular AJAX post for something I use the "data" element of the $.ajax method like this
I have a FileUpload control in the Source page. On the Upload button handler, I read the file into memory (after doing some validations) and since it's always going to be a TXT file, I create a string that I need to pass to the Destination page. I thought of using Cross Page postback and set the PostBackUrl property of the upload button. But it appears that the breakpoint in the Upload button handler is never hit. It directly goes to the Page_Load in the Destination page. If I can't use Cross Page postback and don't want to use Session or the database, how do I pass this string from Source page to the Destination page?
i have a page with a piece of code. what the scenario is that that page can have more than two querystrings. for example it may have home.aspx?pck=1 or sumtimes it may have home.aspx?name=a
so i want to redirect to someother page based on the query string the page has.
[Code]....
this is what i have done now....bt couldnt work through it...its raising an exception saying "reference is not set".
How do I create a query string from photopath on my database.aspx page to my handler.ashx page. I want the handler page to pick up on my photopath string contained here:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { string PhotoPath; GridViewRow row = GridView1.Rows[GridView1.SelectedIndex]; PhotoPath = row.Cells[5].Text; PhotoPath = HttpUtility.UrlEncode(PhotoPath); HttpWebRequest request = (HttpWebRequest) WebRequest.Create(PhotoPath); HttpWebResponse response = (HttpWebResponse) request.GetResponse(); Stream resStream = response.GetResponseStream(); using (System.Drawing.Image img = System.Drawing.Image.FromStream(resStream)) { img.Save("temp.jpg", ImageFormat.Jpeg); } } } } } } } and then to retrieve it in my GetImage.ashx handler page here: public class GetImage : IHttpHandler { public void ProcessRequest(HttpContext context) { { string PhotoPath = System.Web.HttpContext.Current.Request.QueryString["PhotoPath"]; PhotoPath = HttpUtility.UrlDecode(PhotoPath); FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(new Uri(PhotoPath)); request.Method = WebRequestMethods.Ftp.DownloadFile; request.Credentials = new NetworkCredential("Administrator", "commando"); try { FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Stream stream = response.GetResponseStream(); byte[] bytes = new byte[2048]; int i = 0; MemoryStream mStream = new MemoryStream(); do { i = stream.Read(bytes, 0, bytes.Length); mStream.Write(bytes, 0, i); } while (i != 0); context.Response.Clear(); context.Response.ClearHeaders(); context.Response.ClearContent(); context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(mStream.GetBuffer()); } catch (WebException wex) { //throw new Exception("Unable to locate or access your file.\nPlease try a different file."); } catch (Exception ex) { throw new Exception("An error occurred: " + ex); } } } public bool IsReusable { get { return false; } } } }
I created following custom log in control and it redirects user to default.aspx after logging in.I'm not exactly sure where I can specify Destination Page Url.When I logg in, I would like to stay in same page instead of default.aspx. ---- code behind ------
Protected Sub login_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles login.Click If Membership.Providers("custMembershipProvider").ValidateUser(Username.Text, Password.Text) Then FormsAuthentication.RedirectFromLoginPage(Username.Text, Rememberme.Checked)
I was following this tutorial and it worked perfectly: [URL] ....
I was wondering how do I archive this: the file name will be a link button (or whatever the best way is) and when click on the name, it will download the file (instead of haing an additonal "Download" column)?
i have a page from which i send a email to a client which has link to this page with a query string. when we click we fetch the value of query string in the page load. But its showing an error when we load the page because at that time we are not sendign the query string.
I have an ASP.NET website in which I have to perform a certain operation. I have to displaying the ID's from the DB on menu.aspx page in this format {1:2:3:4}. The above format is not a problem and can be just be written with
[Code]....
But here comes my question. I have to generate this ID when the user types the query within the URL somewhat like
[Code]....
Note that I am saying that user will type this URL. I know that query string can pass the values from one form to another but this is a single web form and if I attach this [Code].... , it should return the result. How can this be done?
I have page A, B and C. In the page load of C, i have used a query string parameter to display some tables depending on where it came from, either A or B. Page C has Cancel button. When a user clicks Cancel, it has to check where it came from and should redirect to same page, i mean either A or B. I am not at all sure how to use query string for redirecting.