Setting Hyperlinks In Order For Users To Carry Out Forced Downloads?
May 7, 2010
I am using Microsoft's MVC design pattern and I have a method in my controller, which sets the data source of a gridview. Whilst I can bind all the other values in the gridview, I am stuck setting 4 hyperlinks. The hyperlinks need to work in the explanation given in the link below: [URL]for forcing downloads to keep the location of where files are saved to private, which I want set in the controller.
To fully explain what I am doing, in my controller for the gridview, I am setting the gridview's data source using ICollection, which is an object containing results from a query. From this collection, I extract a value which has the name of a folder which contains a number files. So, what I have done is to cast my collection to a object, to get folder name and then use a foreach loop to get each folder name. Then to get the files inside each folder, I use Directory.GetFiles, which returns a string array - I wrote string[] files = Directory.GetFiles(ConfigurationManager.appsettings["filepath"]+folderName); . I have set 4 properties for each Hyperlink I want to set.
It is at this point where I am stuck, because even though I can get to the files, I am unable to set the Hyperlinks to these files. Each time I try an set the NavigateUrl property, I get the error message Object not set to an instance of an object. Plus, I have two other issues to resolve:1) Even though there are 4 hyperlinks, not every hyperlink will be set. In other words, if there are only two files in the folder, I only want to set the appropriate hyperlinks. So, how can I iterate through the string array, and get each value inside the array to do a check?2) When I set my Hyperlinks in my controller, how do I simply pass the file and keep the file's actual storage location hidden as given in the link [URL]
View 5 Replies
Similar Messages:
Feb 15, 2011
I'm working on adding a new webapp to an existing website. I've been directed to write the webapp in ASP.NET. The existing website is written in ColdFusion. For the most part, the ASP.NET webapp is completely stand-alone, but it needs to interact with the ColdFusion code in one important way - if somebody logs in to the ColdFusion site, we don't want them to have to log in again when visiting an ASP.NET page.
When someone logs in to the ColdFusion site, their username is stored in a cookie, along with a login token that can be looked up in our database. My .NET is a little rusty, so I'm having trouble visualizing how the ASP.NET code should use this data. I've already written a simple MembershipProvider that can be used to log in/out out the ASP.NET app using the data in our existing database tables, which are shared with the ColdFusion code.
What I'd like to know is - how can I make sure the ASP.NET app detects the cookies set by the ColdFusion app (I imagine they'd be sent to the ASP.NET pages, since everything is hosted on one domain), and automatically logs the user in using the MembershipProvider and Forms Authentication, using the credentials supplied in the cookie? I'm thinking that putting some kind of cookie check and log in function in the Global.asax file, set to run every page load for every page... but that seems kind of clunky. Also, do people still use the Global.asax file anyway? I had thought there was a more modern method.... Also, how can I manually log someone in using Forms Authentication and a custom membership provider? Currently my code allows the user to log in using the provided login control, but I'm not sure how to log the user in without them having to do anything.Looking over the MembershipProvider tutorials and the MSDN documentation it seems to me like the answer should be staring me in the face, but for some reason I just can't see it. Maybe not enough coffee....
View 3 Replies
Feb 4, 2010
Some settings in asp.net like viewstate can be controlled at the site (web.config), page, or control levels. What is the order of precedence? What happens, for example, if I set viewstate of site and page levels but on at the control level?
Also, is viewstate for a control the same as control state? Furthermore, what events to use for loading and saving viewstate for controls (is this the same thing as control state?) and also for custom controls?
Similarly, which events should I use to render controls? Is this PreInit and Load? Is this the same for custom controls?
View 1 Replies
Jan 13, 2010
I've made a website online that allows customers to place an order. I would like the information customers input on the website to show once the customer clicks submit to confirm what was entered.
View 2 Replies
Jul 30, 2010
Maxima.exe is a Computer Algebra System built as a native code rather than a managed code. MyService works as a socket server, it will instantiate a new process of Maxima for each browser submitting mathematics expression to Web Server. I cannot use AppDomain here because Maxima is a native code. However I want security policies provided by AppDomain such as restriction to write data on file system.My question is, how can I get the AppDomain-like security policies when I instantiate Maxima in a process rather than in an AppDomain?
View 1 Replies
Mar 26, 2010
in my aspx.vb page i have written
Label1.Text = Me.Page.User.Identity.Name
when i do view in browser (without publishing to any server) i see label's text as
abcxyz which is correct
but when i publish it, i dont see any text . I have made setting IIS to allow anonymous users so that anyone can open the wesite and see their computer login id
like abcxyz
View 1 Replies
Jan 27, 2010
I have a form that uses group validation with the following on btnDonation_Click. However, when I click btnDonation, the page comes back to itself even if everything is valid. Then, I click btnDonation again without changing anything, this is when the page will postback to Confirm.aspx. Do you know what might have caused it?
Code:
Protected Sub btnDonation_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDonation.Click
Page.Validate("GiftValidate")
If (rbContribType.SelectedIndex = 0 Or cbPrefHAddress.Checked = True) Then
Page.Validate("HAddressValidate")
ElseIf (rbContribType.SelectedIndex = 1 Or rbContribType.SelectedIndex = 2 Or cbPrefOrgAddress.Checked = True) Then
Page.Validate("OrgAddressValidate")
End If
If Page.IsValid Then
btnDonation.PostBackUrl = "~/Confirm.aspx"
End If
End Sub
View 28 Replies
Mar 22, 2010
Our user is using integrated windows authentication.
All users hit the login page where they must login with their domain/username/password combination.
Once they login, they can change their password.
Once the password is changed, they are displayed a message and they can navigate through the rest of the site.
I get the following scenarios...
1) User can view one page but not a second page User changes password USer clicks on link and receives page USer clicks on second link and is asked for credentials
2) User can view all pages USer changes password User clicks on link and receives page User clicks on second link (and all links thereafter) and receives page (they are never prompted for credentials)
3) User can not view any pages
User changes password USer clicks on link and is asked for credentials
View 2 Replies
Jan 8, 2010
I have three panels like so:
___ _________ ___
| | | | | |
| | | | | |
| | | | | |
| | | | | |
|___| |_________| |___|
But if I shorten the window a little bit, the middle panel goes below the two side panels:
___ ___
| | | |
| | | |
| | | |
| | | |
|___| |___|
_________
| |
| |
| |
| |
|_________|
Here is my code
<style>
.SidePanel {
background-color:#9999CC;[code]....
View 3 Replies
Apr 16, 2010
I have been using a querystring to carry over the value of a DDL to the next page. Now I want to carry over values of two Drop down lists through Querystring on to my next page.Here is my code to carry over one DDL using QueryString:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Redirect(String.Format("Option1_result.aspx?ddl1={0}", DropDownList1.SelectedValue))
End Sub
View 1 Replies
Jan 5, 2011
i add selected product in shoppingbasket. i add name,price, count etc. i also want to add product's image in shoppingbasket. i show products on datalist. and i show name,price etc in labels. and i show product image in a image object. how can i add a product image in my shoppingbasket class.
View 1 Replies
Apr 13, 2010
I have a FormView in InsertItem that contains one DropDownList linked to a Table Datasource to display ItemCodes. In that "lookup" table I also have a Retail and Cost field.When the user selects the item from the drop down, how can I have these to field carry over into my new record that is being inserted. The new record also has a Retail and Cost field that are TextBoxes.Basically I am populating the new fields with the default values from the DropDownList.
View 1 Replies
Mar 23, 2011
I have a webform set up at [URL]When a user submits that form, I want the browser to go to
[URL]. I want the values in the First and last name textboxes from the form to post into two lables that would replace that line in the first paragraph of the agreement.I think this is using the postback feature, but I am unsure exactly how this would be implemented.
View 4 Replies
Jan 23, 2010
I have 5 hard corded texboxes in a page in a sequence with sequence Number . Now i want to add re-order /re-arraning functionaly .. but i can't use ajax reorder list because i have 5 hard corded texbox. how can i maintain the order in Insert/Update cases. And also suggest me control that i can use, another than ajax re-order list. coz i not using any list items i have hard corded items on the page.
View 1 Replies
Feb 7, 2011
The AjaxToolkit has a ReorderList. I'm searching for a jQuery solution that does the same and found this page. I would like to change the order of divs (vertically) and upload the new order to the database (ajax).
View 2 Replies
Oct 22, 2010
I have two table Order and Order Detail.
What i need is i need to bind last 10 Order in Gridview/details view with paging, and the same order detail also fetch from database and shown in another gridview.. if user click any oderNo in first Gridview/DetailView then i need to show Respective order detail in anther gridview..
without postback coz we already fetch 10 order with orderdetails from the database..and if user click next 10 orderNo using paging then again we need to load 10 orderNo with respective orderdeatils from database like this going on....as well as let me know how to take print of particular oder and order detail....?
View 7 Replies
Apr 24, 2010
From my testing, it appears that the order of parameters for the UpdateParameters must match both the order of the bound fields on the form (asp:Formview), and the order of the parameters in the UpdateCommand. Is that correct? If so, why do the parameters have names if all that matters is the order? I tried both asp:ControlParameter and asp:Parameter. Maybe the more relevant question is why aren't the names used instead of the order, particularly for the form order?
So, given I display the Identity field (CID), and need that for the update, I cannot get the update to work without including it in the UpdateCommand. Of course, since it is an autonumber field in Access, I cannot actually set it. So, I had to add another field to the db (lngUpdateCID) that I could set. That can't be how it has to be done, but I could not figure out another way to do this.
The relevant code is below:
[Code]....
View 23 Replies
Aug 2, 2010
How to track downloads with ASP.NET?
I want to find how many users completed the file download?
Also How can make restrict user from specific IP?
for example if a user download [URL] the track will work automatically.
View 3 Replies
May 20, 2010
I need to provide downloads of large files (upwards of 2 GB) on an ASP.net website. It has been some time since I've done something like this (I've been in the thick-client world for awhile now), and was wondering on current best practices for this I would like:
To be able to track download statistics: # of downloads is essential; actual bytes sent would be nice.
To provide downloads in a way that "plays nice" with third-party download managers. Many of our users have unreliable internet connections, and being able to resume a download is a must. To allow multiple users to download the same file simultaneously.
My download files are not security-sensitive, so providing a direct link ("right-click to download...") is a possibility. Is just providing a direct link sufficient, letting IIS handle it, and then using some log analyzer service (any recommendations?) to compile and report the statistics? Or do I need to intercept the download request, store some info in a database, then send a custom Response? Or is there an ASP.net user control (built-in or third party) that does this?
View 1 Replies
Jul 28, 2010
I've got SL application where i should implement file managment subsystem. I've got hierarchical structure of filesfolders(just description). Also each filefolder has its own permissions to usersgroups. I would like implement that one user who has permission to download file couldn't give it to another user, who hasn't this permission. So if user has download permission he get link [URL] and download it. But he could give this link to another person without permission.
View 2 Replies
Feb 25, 2011
I have a few ideas on how to accomplish this, but before I make a big mess perhaps there's an obviously easy solution I'm not seeing.
So I have on my site software (.NET 2, C#) a calendar, and I've recently added some code to generate a temporary iCalendar file from an event, and e-mail it to the logged in user. That part works great; the temp file is created, a MailMessage is created with teh attachment, it's sent, and then the temp file is deleted.
I want to change this into a "download" as opposed to an e-mail. So I generate the temp file, but present it to the user as a download instead (so they can open/save it immediately). That's all fine, but where I'm stuck is how to "know" the download has been completed, so I can then delete the tempoary file.
I have "hacky" options like timers and whatnot to do cleanup, but I'm wondering if I'm missing a better solution.
View 4 Replies
Mar 20, 2010
This is my first time coding with ASP.NET!I've created a simple webpage and I need to know how to count the number of downloads of a file from my webpage.The download will be started through a button.And the other question is:Where should I store this information?
View 4 Replies
Mar 5, 2010
want to download the individual files from weburl. There are images listed on the website along with the check box for each image. User can select one or more images by checking the checkbox. When user click on Download button it should start downloading the files sequentially one after the other. File size is between 20mb to 200mb each.
View 4 Replies
Jan 4, 2010
I create a custom http handler to block download of .wmv files e.g. www.pakdev.net/videos/file.wmv (blocked by httpHandler).
But the problem is that now silverlight cannot also stream these video files as they are blocked too.
View 1 Replies
Jan 29, 2010
I guess what im really saying is if i put a link to an mp3 file on a page, and i wanted that file to be able to be downloaded by the user is there a way to count the number of times that link has been pressed by a page user?
View 2 Replies