|
Hi,
I created one user with name "srinivasanb" and pwd "Mpls7880" in my system giving full rights for that user( In my system only i have docs folder for file server) and same username & pwd was created on host system there also giving full rights for that user.
In put web.config and data.config and bin folder,template folder,xml folder,documents folders in docs folder in my system.
In web.config file i included the following code
------------------------------------------------
httpHandlers
add verb="*" path="*.pdf" type="Coverpoint.WillisBloodstock.BusinessServices.FileHandler,BusinessServices"
add verb="*" path="*.doc" type="Coverpoint.WillisBloodstock.BusinessServices.FileHandler,BusinessServices"
add verb="*" path="*.xml" type="Coverpoint.WillisBloodstock.BusinessServices.FileHandler,BusinessServices"
add verb="*" path="*.xls" type="Coverpoint.WillisBloodstock.BusinessServices.FileHandler,BusinessServices"
/httpHandlers
add key="WebSiteURL" value="http://localhost/Bloodstock2.2/"/
authentication mode="None"/
authorization
allow users="*"/
/authorization
In globalization tag i am giving the username and password which were created in my system and hosted machince (on both machines users should have same name and pwd)
identity impersonate="true" userName="zslindia\srinivasanb"
password="Mpls7880" /
Note:I removed less thn and greater than symbols ( tags )in web.config please recognise so that to print user friendly
login.aspx
----------
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
txtUserName.Text.Trim(),
DateTime.Now,
DateTime.Now.AddMinutes(180),
true,
txtPassword.Text.Trim(),
FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
// Create the cookie.
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
//Response.Cookies.Add(new HttpCookie("username", euser.UserName));
Response.Cookies.Add(new HttpCookie("userid", euser.UserId.ToString()));
//Userinfo is put into session object
Session["sUserObject"] = euser;
filehandler.cs
--------------
public void ProcessRequest(System.Web.HttpContext context)
{
string FileName = context.Server.MapPath(context.Request.FilePath);
if (System.Web.HttpContext.Current.Request.Cookies["Coverpt"] == null || System.Web.HttpContext.Current.Request.Headers["Referer"] == null)
{
context.Response.Redirect(System.Configuration.ConfigurationSettings.AppSettings["WebSiteURL"] + "Common/Login.aspx?User=Anonymous&ReturnUrl=" + System.Web.HttpContext.Current.Request.RawUrl.ToString());
}
else
{
if (FileName.ToLower().EndsWith(".xls"))
{
context.Response.ContentType = "application/vnd.ms-excel";
context.Response.WriteFile(FileName);
}
else if (FileName.ToLower().EndsWith(".doc"))
{
context.Response.ContentType = "application/vnd.ms-word";
context.Response.WriteFile(FileName);
}
else if (FileName.ToLower().EndsWith(".pdf"))
{
long appId = 0;
long originalAppId = 0;
int clauseId = 0;
FileName = FileName.ToLower();
string filename = FileName.Replace(".pdf", "");
// int lastIndex = 0;
// int stringLength = 0;
// System.IO.FileInfo a = new System.IO.FileInfo(FileName);
if (FileName.ToLower().IndexOf("endorsement") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 1)
{
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 1]);
}
//appId = Convert.ToInt64(filename.Substring(filename.LastIndexOf("_")+1));
}
else if (FileName.ToLower().IndexOf("wemmta") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 1)
{
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 1]);
}
//appId = Convert.ToInt64(filename.Substring(filename.LastIndexOf("_")+1));
}
else if (FileName.ToLower().IndexOf("certificate") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 2)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 1]);
}
}
else if (FileName.ToLower().IndexOf("wem") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 3)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 3]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
}
}
else if (FileName.ToLower().IndexOf("schedule") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 3)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 3]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
}
}
else if (FileName.ToLower().IndexOf("invoice") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 3)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 3]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
}
}
else if (FileName.ToLower().IndexOf("wording") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 1)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 1]);
}
}
else if (FileName.ToLower().IndexOf("quotation") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 1)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 1]);
}
}
else if (FileName.ToLower().IndexOf("clause") > 0)
{
string[] splitedString = filename.Split('_');
if (splitedString.Length > 2)
{
appId = Convert.ToInt64(splitedString[splitedString.Length - 2]);
originalAppId = Convert.ToInt64(splitedString[splitedString.Length - 1]);
}
else
{
clauseId = Convert.ToInt32(splitedString[splitedString.Length - 1]);
}
}
Int32 userId = 0;
if (System.Web.HttpContext.Current.Request.Cookies["userid"] != null)
{
userId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Cookies["userid"].Value);
}
if (userId > 0)
{
DAL.CommanTask commanTaskDALObj = new CommanTask();
bool verified = commanTaskDALObj.VarifyPDFDocument(userId, appId, originalAppId, clauseId);
if (verified == true)
{
context.Response.WriteFile(FileName);
}
else
{
context.Response.Redirect(System.Configuration.ConfigurationSettings.AppSettings["WebSiteURL"] + "Common/Login.aspx?User=Anonymous&ReturnUrl=" + System.Web.HttpContext.Current.Request.RawUrl.ToString());
}
}
else
{
context.Response.Redirect(System.Configuration.ConfigurationSettings.AppSettings["WebSiteURL"] + "Common/Login.aspx?User=Anonymous&ReturnUrl=" + System.Web.HttpContext.Current.Request.RawUrl.ToString());
}
}
}
}
Now i am trying to give physical path of the pdf i am getting the following error"system.security.securityexception:request for the permission of aspnethosting permission version=1.0.5.000...culture=neutral publickeytoken=b77.." instead i need to go login.aspx page for the security purpose after login credentials were matched na i pdf will get opened that is the requirement
some time i am getting the errror please do some help regarding this task
thanks and regards,
eswar
-- modified at 9:17 Wednesday 23rd May, 2007
|
|
|
|
|
I also had the same message. But i was not using any security related things in my Web App. I resolved my problem by running "aspnet_regiis -i". When I had this problem i searched and found that this problem arises if IIS is installed after the VS.Net 2005 / 2003. Try this. It might help you too.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hi All
How can I add Textbox Dynamically when I click on a button in Javascript. Pls give me an example.
Thanks in Advance.
|
|
|
|
|
hello Bangash,
onbutton click call a function
OnClick = "return AddText();"
AddText()
{
response.redirect("Be A Good S/W Eng... Life is swing with you..Enjoy..
|
|
|
|
|
Thank u yar but its not working.
|
|
|
|
|
Hi
add a div in to your page, where you want to add the text box.
eg:
<br />
<div id="div1"></div><br />
then in your javascripr code add following code to create text box
<br />
document.getElementById("div1").innerHTML+="<input type='text' <br />
name='text1'/>";<br />
I think this will help You. please post your result.
-- modified at 8:20 Wednesday 23rd May, 2007
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Thank u very much I applaying ur formula and successed.
|
|
|
|
|
hi,
How you will access the text box value.
Did you try that.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Hi,
document.write("");
but it will take your program more complicated
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Sherin Iranimose wrote: document.write("");
But What will the the position of the newly added control
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi Sandeep,
its not possible.
So I gave him an another solution.
I gave the another solution only because of your feed back.
Thank you...
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
|
Hi,
You told me that it is successed.Then what solution.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
Hai all...
i want code for delete a selected row from datagrid. i have checkboxes on every row if i check and press delete button .That should be deleted.
any one have code or any idea plz help me
Suresh.R
|
|
|
|
|
sooreeagt wrote: want code for delete a selected row from datagrid
Start a loop till datagrid item count. Find the checkbox using findcontrol method. Check it is checked. If checked then delete. Code could be something like
private void DeleteGrid()
{
for(int i=0;i<=DataGridName.Items.Count-1;i++){
CheckBox chk = (CheckBox)DataGridName.Items[i].FindControl("yourcontrolName");
if ( chk.Checked )
}
}
|
|
|
|
|
Do this
////in the delete button click
CheckBox cb;
foreach(DataGridItem it in DataGrid1.Items)
{
cb=(CheckBox)it.FindControl("CheckBox1");
if(cb.Checked==true)
{
string st=((Label)it.Cells[1].FindControl("Primary keycolumn name")).Text;
dataAdapter =new SqlDataAdapter("delete from AccountCode where AccountId=" + st,con);
dataAdapter.Fill(ds,"deleteTable");
}
}
DisplayRecords(); //some procedure to bind the data
This should run...make modifications curructly
|
|
|
|
|
|
Hi,
Hi please reply to the original message.
Then only the person grta notification mail.
To succeed, we must first believe that we can.
Sherin Iranimose
|
|
|
|
|
In the properties of your datagrid there will be something called datakeyfield set it to the primary key of your table and the write a function which calls normal delete in DB.
For this press on the lightning icon i the properties and select deletecommand type the function in it and press enter then wirte your code in that block.
|
|
|
|
|
Hi,
My company want me to make some modifications on a web application that uses MS CRM.I have downloaded the CRM SDK but I couldn't understand how to use it and how to start.
Could any one explain to me the basic idea in developing CRM and reach its entities or at least lead me to helpful articles.
I am too late but i will never give up
|
|
|
|
|
Gday everyone,
I have a new problem that I need some expert help.
I have a DetailsView to display a data table pulling from SQL Server database at runtime.
My method returns the whole table of the user depending on user name and password when they login.
How can I select and display some fields only?
How can I change the field name because they don't look good on display?
Please help. I greatly appreciate it.
eric
|
|
|
|
|
Hi
I have one idea..about your query....
for selected colums just use condition like where or filters...
and you want field name in good way am i ?
then in query use AS key word like
select uid as UserId from emptable.
This is best of my knowledge.I feel happy if it makes any favour to you
Suresh.R
|
|
|
|
|
Thanks so much.
I'll try that
eric
|
|
|
|
|
Hi guys, I have one query,
I have one URL, usisg this URL how can i send XML request and get XML response? is it possible? if is it possible please help me how can i do. iam so new for this one.
Thanking you and regards,
praveen kumar..
Praveen Kumar.R
|
|
|
|
|
Do you mean AJAX ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|