|
=))
I found it =)
I reasd that article once before but know I saw it.
Thanks =)
//h
-- modified at 12:04 Monday 3rd July, 2006
|
|
|
|
|
Hi friends,
I suddenly stuck up today will any one help me out. The problem is like this.
I have a site in asp.net where to view pages login is required. I've used form authentication to solve this problem. Now after these pages are called they have links to pdf documents. these pdf documents are visible only if the user is a subscriber to this document.But once the URL is known, any body can know the directly access the pdf documents. Can it be possible with form authentication so that whenever the URL path to the pdf document is entered directly, the user is redirected to Login page.Also how could we distinguish that this user is a subscribed user or guest user and which of document he is allowed to see.
Thank You
Warm Regards:-
Tech4U
|
|
|
|
|
You may want to consider creating an HTTP handler for the PDF requests.
Instead of linking directly to the PDF, you would link to your HTTP handler, passing a document identifier in the query string. The handler would be responsible for handling user security and retrieving the PDF on the user's behalf. Sending the PDF via an HTTP handler would look something like:
using System;
using System.Web;
namespace Example
{
public class PDFServer : IHttpHandler
{
///
/// Signals whether the instance of the HttpHandler is reusable
/// accross requests.
///
///
/// <value>True if the instance is reusable, False otherwise
///
public bool IsReusable
{
get
{
return true;
}
} // End property IsReusable
///
/// Performs the needed processing and rendering for an Http Request.
///
///
/// <param name="context" />The Http contect for the request
///
public void ProcessRequest(HttpContext context)
{
// Grab the document id from the query string and use it to determine
// the document name and the path.
string docId = context.Request.Params["docId"];
string docName = DetermineDocumentName(docId);
string path = DetermineDocumentPath(docId);
// Set the response header to suggest a default file name.
context.Response.AppendHeader(String.Format("content-disposition","attachment; filename={0}", docName));
// Set the appropriate MIME type for a PDF file.
context.Response.ContentType = "application/pdf";
// Read the file directly to the response stream, then end the response.
context.Response.WriteFile(path);
context.Response.End();
} // End method ProcessRequest
} // End class PDFServer
} // End namespace Example
You can find plenty of information on creating HTTP handlers on the web. I'd
recommend looking at:
- Microsoft's How To Create an ASP.NET HTTP Handler by Using Visual C# .NET,
here[^]
- Michael Flanakin's blog entry[^] on the topic
Hope that helps.
--Jesse
|
|
|
|
|
Thank u Jesse.
I proceded as u have guided and the outcome is good, but now my program only distinguishes between authenticated user and anonymous users. I need a method from which I can know whether the said user is a subscriber to that document or not.
Now suppose a situation can be created like this:-
A person X has subscribed a document "abc.doc" now X is able to see the document and also can see the full URL. Now if he copy the url and give it to other person Y. Then Y can do these steps to see the document
1)Login
2)paste the url given by X
Then he will be able to see the document, even if Y is not a subscriber to that document.
Please help to rectify this.
Thank U.
|
|
|
|
|
Hi,
I want to maintain the viewstate when i go from one Page to another.For eg: I have a Page with textboxs and Datagrid. When there is data in the first Page and when i go to another Page and come back , i want to see the data in the first Page. How to do? I have enabled Viewstate in the Page and for all controls, even then the data disappears.
|
|
|
|
|
View State is enabled for the same page. that is if post back to the same page then the values are retained . But if you go to another page you can create hidden fields in that page and then post that page to your page. then you can get the values by request.form(name of the hidden field).
for eg there is a textbox in form a . if you post to form b then create a hidden
field in form b and get its value in it. Then again post form b to form a then the values of th text box can be extracted by
textbox1.text=request.form("hidden field");
|
|
|
|
|
ViewState is a mechanism to remember control data during postbacks to the same page. It is not a state management tool for retaining data as you navigate a site, so it isn't going to be helpful to you in this context.
What you'll want to look into is programatically collecting that data that you'd like to maintain and saving it for use during the user's session. There really isn't a built in mechanism to handle this task, you will need to program for it. In general, this is referred to as "Session State".
A Google search[^] returns plenty of hits to sort through. I'd recommend taking a look at:- This[^] article over at Informit on ASP.NET session state beginnings
- This[^] article at Informit on more advanced session management
Hope that helps.
--Jesse
|
|
|
|
|
Hi,
I have a datagrid and i am using datatable to bind it. There are 5 textboxs .Once i fill the textbox, i click a button ADD and the data from textboxs are added to datagrid. So i use datatable. Problem is when the Page is loaded, datagrid does not appear even if there is no data. Datagrid is visible only when we bind to datatable. Is it possible to display datagrid without any rows showing "NO Data" and display rows when we click ADD button.
hope U got my question.
|
|
|
|
|
use datagrid headers this may help u.
|
|
|
|
|
Datagrid Headers are displayed only when we bind to datasource. Is it possible to display datagrid headers without setting the datasource.
|
|
|
|
|
public sub fillgrid()
dim dt as new datatable
dim ds as new dataset
dim dr as datarow
dim i as integer
dim con as new sqlconnection("conn")
dim da as new sqldataadapter("select * from TableName",con)
da.fill(ds)
if ds.tables(0).rows.count>0
dt.coloumns.add(new datacolumn("EmpNo"))
---Like that u can use after
for i=0 to ds.tables(0).rows.count-1
dr=dt.newrow
dr=ds.tables(0).rows(i).item("EmpNO")
dt.rows.add(dr)
Next
datagrid1.datasource=dt
datagrid1.databind()
else
datagrid1.datasource=nothing
datagrid1.databind()
end if
end sub
Murali Mohan Naidu.Vemula
|
|
|
|
|
Hi,
use datagrid headers and dont use autoGenerateColumns. Mention the columns yourself and then bind the grid to null at the pageload event(Ofcourse in if!isPostBack).
This will help you
Thanks,
Sushant Duggal.
|
|
|
|
|
I am using datatable for displaying in the grid, so i cant make autogenerate to false. Is there any other way to dynamically generate data in the Grid.
From the textboxes i am showing the data directly to Datagrid. Is there any way of displaying it.
|
|
|
|
|
Sir,
I am using the following code for sending the mail.
Dim objMail As New MailMessage<br />
<br />
objMail.From = "pankajgarg10@rediffmail.com"<br />
<br />
objMail.To = "amaneet.brar@rediffmail.com"<br />
objMail.BodyFormat = MailFormat.Text<br />
objMail.Priority = MailPriority.High<br />
objMail.Body = "This is my first email sent via ASP.net"<br />
Dim smtp As SmtpMail<br />
smtp.SmtpServer = "digitech"<br />
smtp.Send(objMail.From, objMail.To, "abc", "wdc")
and there occurs the following error
The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for amaneet.brar@rediffmail.com
Please help
|
|
|
|
|
Hi amaneet,
There is an option to be enabled before you start sending emails.
In the IIS , go to SMTP Server -- > right click select properties.Under the tab "access", the last option is for Relay. Tick the checkbox at the bottom and coose the option "All except the list below" from the two radio buttons,
I hope this works,
Thanks
Sushant Duggal.
|
|
|
|
|
Hi friends,
Can anyone tell me from where I can get Mail Editor like the one in Microsoft Outlook..
Basically I want an Interface for sending HTML mails with images in the body or files as attachments.
Thanks for your time,
Sushant Duggal.
Sushant Duggal.
|
|
|
|
|
You may wish to have a look at FreeTextBox[^]. It is a WYSIWYG editor for HTML that supports several themes, one of which is Office 2003. It is a generic text input control, however. You'll need to handle the mail portions on your own.
Hope that helps to get you started.
--Jesse
|
|
|
|
|
Hi,
I want to send a ASP.NET mail with embedded images in the mail body. Can any one help me with how I can do that.
I am using ASP.NET 1.x
Thanks
Sudhakar
|
|
|
|
|
You may wish to take a look at my reply[^] to your earlier posting of this question. I included several links to help you get started.
--Jesse
|
|
|
|
|
I have created web application in Asp.net 1.1. Now I want to create the home page such that the client can personalise the page to view weater,stock, tec details. (Like the Google Home page)
The client should be able to change the layout of the home page also. In ASp.net 2.0 we can use Webpart tool for this.. But i didn't get any help for asp.net 1.1.
i am using webservices to show the weather and stock details in the page.
Can anyone help me to change the layout of the page by client?
Thanks
|
|
|
|
|
I am using VS 2005 and SQL Server 2000. I want to store a huge of text in a field of my database.I have used ntext type but it's not large enough.
Can anybody help me.
Thanks
|
|
|
|
|
How big are the text fields that you are storing? ntext's length is 2^31 - 1 characters...
You must have a whopping server...
but anyway, i believe that is the largest data type field available in sql server. Can you maybe store the text in .txt files on a server and then store the link to them in the DB?
|
|
|
|
|
char - Fixed-length non-Unicode character data with a maximum length of 8,000 characters.
varchar - Variable-length non-Unicode data with a maximum of 8,000 characters.
text - Variable-length non-Unicode data with a maximum length of 2^31 - 1 (2,147,483,647) characters.
nchar - Fixed-length Unicode data with a maximum length of 4,000 characters.
nvarchar - Variable-length Unicode data with a maximum length of 4,000 characters. sysname is a system-supplied user-defined data type that is functionally equivalent to nvarchar(128) and is used to reference database object names.
ntext - Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters.
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
|
sorry if the question is stupid
When I store the content of an article in SQL Server ,I only insert a half of it and I can type anymore.I don't know how ->post question.Anyone who know about my problem can help me?Thanks.
|
|
|
|