|
I have a Web Service that is receiving a file, and putting into a SQL Database. For some reason this method gets an error, while all the others work. Through searching the web all the results say I need to change my IIS setup, which I did not do because it is already setup the way they want.
So, any ideas why I can't call this method:
public void AddSong(string Name, string Artists, string Album, string Genre, int YearPublished, string Path, DateTime DateAdded, byte[] FileData, string MD5)
Without this error:
The request failed with HTTP status 400: Bad Request.
I can post any code you think is relavant, but with my searches it seems like it isn't a code issue. Am I doing something not allowed?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
It can be cause of Access Permission. Seem, the file need to write in your system so its required permission. Did you create Application Pool on IIS. Create New Application Pool, Change the Identity of Application pool to local system, then assign the application pool to that Virtual Directory then Try test. Hope this will resolve your issue.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I am not writing it to the file system, straight to SQL...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Yeah, tried that just in case, didn't work.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
I have a datagrid and i given that inside a .It is now scrollable.But i want the headers static.Where should i give the header.
Code is below
<div style="BORDER-RIGHT: navy 2px solid; PADDING-RIGHT: 1px; BORDER-TOP:
navy 2px solid; PADDING-LEFT: 1px; LEFT: 0px; PADDING-BOTTOM: 1px; OVERFLOW:
auto; BORDER-LEFT: navy 2px solid; WIDTH: 850px; PADDING-TOP: 1px;
BORDER-BOTTOM: navy 2px solid; POSITION: relative; TOP: 10px; HEIGHT: 230px">
<ASP:DATAGRID id="DGInbox" runat="server" Width="100%" BackColor="White" BorderColor="#DEDFDE"
Font-Name="arial" Font-Size="Small" HeaderStyle-BackColor="#ffcc99" DataKeyField="UserName"
OnEditCommand="DGInbox_Edit" OnCancelCommand="DGInbox_Cancel" OnUpdateCommand="DGInbox_Update"
AutoGenerateColumns="False" AllowPaging="True" AllowCustomPaging="False" PageSize="15" GridLines="Both"
PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Center" PagerStyle-NextPageText="Next"
PagerStyle-PrevPageText="Prev" OnPageIndexChanged="DGInbox_Page" Font-Names="verdana" OnItemDataBound="DGInbox_OnItemDataBound"
AllowSorting="True" OnSortCommand="DGInbox_Sort" BorderWidth="1px" BorderStyle="none" EnableViewState="True"
CellPadding="2" CellSpacing="0">
<FooterStyle BackColor="#CCCC99"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#CE5D5A"></SelectedItemStyle>
<AlternatingItemStyle BackColor="White"></AlternatingItemStyle>
<ItemStyle BorderColor="White" BackColor="#F0F8FF"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#6699cc"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Result">
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<!--<asp:HyperLink id="testresult" Text='<%# DataBinder.Eval(Container.DataItem, "DB_CANDT_RESULT")%>' NavigateUrl='<%# "TestResult.aspx?id=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"UserName").ToString()) + "&QStrTestId=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"TestId").ToString()) + "&QStrResult=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"DB_CANDT_RESULT").ToString()) + "&QStrCandidate=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"CandidateName").ToString())%>' runat="server" Target="_blank" />-->
<a href="#" onclick="oEditorWindow = window.open('<%# "TestResult.aspx?id=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"UserName").ToString()) + "&QStrTestId=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"TestId").ToString()) + "&QStrResult=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"DB_CANDT_RESULT").ToString()) + "&QStrCandidate=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"CandidateName").ToString()) + "&QStrCandidateBatch=" + HttpUtility.UrlEncode(DataBinder.Eval(Container.DataItem,"BatchName").ToString())%>','a','scrollbars=1,resizable=1,width=800,height=400,left=100,top=150,screenX=0,screenY=100');" id="A1"><%# DataBinder.Eval(Container.DataItem, "DB_CANDT_RESULT")%></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Name" SortExpression="CandidateName">
<HeaderStyle Font-Bold="True" ></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<a href="javascript:void(window.open('CandidatePersonalDetails.aspx?CID=<%# DataBinder.Eval(Container.DataItem, "DB_CANDT_ID")%>&Type=<%# DataBinder.Eval(Container.DataItem, "CandidateType")%>®Type=<%# DataBinder.Eval(Container.DataItem, "RegistrationType")%>',null,'width=700,height=250,left=150,right=150,top=180,resizable=yes,scrollbars=1'));"><%# DataBinder.Eval(Container.DataItem, "CandidateName")%></a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="RegistrationDate" HeaderText="Reg Date" SortExpression="RegistrationDate" DataFormatString="{0:yyyy-MMM-dd}">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="City" HeaderText="Location" >
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CandidateType" HeaderText="Type">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DB_CANDT_SCREENINGSTATUS" HeaderText="OnlineScreening">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Email" HeaderText="e-Mail" SortExpression="Email">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Experience" HeaderText="Exp">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="CurrOrg" HeaderText="CurrOrg">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="AOA" HeaderText="AOA">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="ACT" HeaderText="ACT">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="PhoneNumber" HeaderText="Phone">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="MobileNumber" HeaderText="Mobile">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DB_CANDT_ADRS" HeaderText="Address">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DB_CANDT_TSTATUS" HeaderText="Status">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DB_CANDT_TS_TIME" HeaderText="Start Time">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DB_CANDT_TE_TIME" HeaderText="End Time">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="DB_CANDT_TTAKEN" HeaderText="Time Taken">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Re-Schedule">
<HeaderStyle Font-Bold="True" Wrap="False"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<a href="Schedule.aspx?id=<%# DataBinder.Eval(Container.DataItem, "DB_CANDTEST_ID")%>&QStringCandtName=<%# DataBinder.Eval(Container.DataItem, "CandidateName")%>&type=<%# DataBinder.Eval(Container.DataItem, "RegistrationType")%>&email=<%# DataBinder.Eval(Container.DataItem, "Email")%>&BNAME=<%# DataBinder.Eval(Container.DataItem, "BatchName")%>&Qlocation=<%=m_LocationSelected%>&Uid=<%# DataBinder.Eval(Container.DataItem, "UserName")%>&pwd=<%# DataBinder.Eval(Container.DataItem, "Password")%>" id="lnkreschedule">Re-Schedule</a>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Comments">
<HeaderStyle ></HeaderStyle>
<ItemTemplate>
<a href="javascript:void(window.showModalDialog('HRComments.aspx?CID=<%# DataBinder.Eval(Container.DataItem, "DB_CANDT_ID")%>&QStringCandtName=<%# DataBinder.Eval(Container.DataItem, "CandidateName")%>',null,'dialogHeight:12em;dialogWidth:15em;status:no;scrolling:no'));">Comments</a>
<!--<a href="#" onclick="ShowDetails();GetCandId('<%# DataBinder.Eval(Container.DataItem, "DB_CANDT_ID")%>','<%# DataBinder.Eval(Container.DataItem, "CandidateName")%>',popHRComments)">Comments</a>-->
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderStyle BorderStyle="None" BackColor="White"></HeaderStyle>
<ItemTemplate>
<!--<a href="DeleteUser.aspx?id=" id="lnkDelete" onclick="return ConfirmDeletion();">Delete</a>-->
<a href="DeleteUser.aspx?id=<%# DataBinder.Eval(Container.DataItem, "DB_CANDT_ID")%>&STATUS=<%=m_StatusSelected%>&QStrLocation=<%=m_LocationSelected%>&QStrCurrPageIndex=<%=CurrPageIndex%>" id="lnkDelete" onclick="return ConfirmDeletion();">Delete</a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle NextPageText="Next" PrevPageText="Prev" HorizontalAlign="Right" ForeColor="Black"
BackColor="#6699cc" Mode="NumericPages"></PagerStyle>
</ASP:DATAGRID>
</div>
|
|
|
|
|
Please post properly.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hai Abhijith,
I got it,Thanks for the response and sorry for the bad posting
|
|
|
|
|
Hi,
there was no code...what was the problem...?
S Kumar
|
|
|
|
|
Hai Kumar,
Thanks for the response,i got hte solution, sorry for the bad posting
|
|
|
|
|
with out doing any serialization can i use the class created by the xsd in two projects to communicate between two.
|
|
|
|
|
Well, you can, but you need to define how. How do you expect to send a class instance from one project to another ? What sort of projects are they ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
what i intend to do is after creating the class from xsd and add them to both projects manually
|
|
|
|
|
can any one guide me on creating common classes for two applications.
|
|
|
|
|
Craete a dll with your class in and reference it in both projects.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I want to apply stylesheet to the HTML format of mail.
I dont want to use code like :
string strBody="";
strBody += "<table><tr><td style='font-family: Verdana; font-size: 10pt;'>Hi,";
strBody += "</td></tr></table>";
Instead of that want to use :
string strBody="";
strBody += "<table><tr><td class='verdanaText'>Hi,";
strBody += "</td></tr></table>";
ObjMail.BodyFormat=MailFormat.Html;
ObjMail.Body=strBody;
Is it possible to use what I expected??
|
|
|
|
|
Deepml wrote: Instead of that want to use :
string strBody="";
strBody += "";
ObjMail.BodyFormat=MailFormat.Html;
ObjMail.Body=strBody;
Did you check it? How it will get class='verdanaText' . You have to write the cssclass also with the BodyString.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Abhijit Can you please tell me how to write that cssClass with Bodystring,I mean how to write
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Deepml wrote:</div>mean how to write <link href="../includes/style.css" type="text/css" rel="stylesheet"> </link></blockquote>
Not, its not like that.
I want to mean, Create a mail content file like
<html>
<body>
<style>
.FontHeaderStyle
{
font-size: 12px;
font-family: verdana;
color:#C41230;
}
</style>
<table>
<tr>
<td class="FontHeaderStyle">
This is Sample HTML Mail
</td>
</tr>
</table>
</body>
</html>
Now, read the content as Text Reader and put it in mail body. Hope this is not clear to any. Any doubts ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Thanks Abhijit.. I got it 
|
|
|
|
|
Go ahead.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi,
I have a DataGrid and i am using the code below to read it.It is reading all the records and working fine.But if i want to read only the recods that are currently displaying the grid(for grid paging is there and at a time it is displaying 10 records).After that i am inserting this to excel file.According to the paging i want the recods to insert in excel(ie 1-10 or 10-20 or 30-40) What should i change in the code? Thanksin advance
public void ExportDataToExcel(DataTable datatable, string[] Headers, string SourcePath, string DestinationPath)
{
int i, j;
string strSourceTemplate = "";
string strDestFileName = "";
string strHeaders = "";
string strRow = "";
System.Data.OleDb.OleDbConnection objXlsCon = null;
System.Data.OleDb.OleDbCommand objCmd;
try
{
objXlsCon = new System.Data.OleDb.OleDbConnection();
if (datatable.Rows.Count > 0)
{
strSourceTemplate = SourcePath;
strDestFileName = DestinationPath;
System.IO.File.Copy(strSourceTemplate, strDestFileName);
objXlsCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDestFileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;MAXSCANROWS=1;\";";
objXlsCon.Open();
objCmd = new System.Data.OleDb.OleDbCommand();
objCmd.Connection = objXlsCon;
for (i = 0; i < Headers.Length; i++)
{
strHeaders += Headers[i].ToString() + ",";
}
string s=datatable.Columns[0].ColumnName;
int k=0;
foreach (DataRow drow in datatable.Rows)
{
for (j = 0; j < datatable.Columns.Count; j++)
{
if(Headers.Length > k)
{
if(datatable.Columns[j].ColumnName == Headers[k].ToString())
{
if(drow[j].ToString() != "" )
{
strRow += drow[j].ToString() + "','";
}
else
{
strRow +="-'"+",'";
}
k++;
}
}
}
objCmd.CommandText = "Insert into [Sheet1$] (" + strHeaders.Substring(0, strHeaders.Length - 1) + ") values ('" + strRow.Substring(0, strRow.Length - 3) + "')";
objCmd.ExecuteNonQuery();
strRow = "";
j = 0;
k=0;
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
objCmd = null;
objXlsCon.Close();
}
}
|
|
|
|
|
Hi,
You can use this code,it directly exports only the current records of the page
Response.ClearContent()
Response.AddHeader("content-disposition", "attachment;filename="& Your File Name & ".xls")
Response.Charset = ""
Response.ContentType = "application/vnd.xls"
Dim stringWriter As New System.IO.StringWriter()
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWriter)
'dgview is your datagrid
dgview.AllowPaging = true
dgview.DataSource = Your Data Source
dgview.DataBind()
dgview.RenderControl(htmlWrite)
Response.Write(stringWriter.ToString())
Response.End()
and also you can apply some styles for excel sheet....
Hope this will help you...
S Kumar
|
|
|
|
|
Hai,
I am using c# ,and no idea about vb. If some other code or idea is there, pls share.In my code the foreach loop is searching for the whole recods.What should i change there?
foreach (DataRow drow in datatable.Rows)
{
for (j = 0; j < datatable.Columns.Count; j++)
{
if(Headers.Length > k)
{
if(datatable.Columns[j].ColumnName == Headers[k].ToString())
{
if(drow[j].ToString() != "" )
{
strRow += drow[j].ToString() + "','";
}
else
{
strRow +="-'"+",'";
}
k++;
}
}
}
Thanksss
|
|
|
|
|
hi,
i think instead of for each you can use for loop
and you have to pass the records number (ie; 1-10,11-20) based on the current index page of datagrid....
or else convert my previous code to C#.NET ,that is working fine for me ...
S Kumar
modified on Friday, March 13, 2009 5:12 AM
|
|
|
|
|
i have a web service(A) and web application (B) . B calls methods in A, for method A.X(Customer) i use the customer object which is created by XSD. after creating the Customer class by the XSD i added this file to both A and B. but when i call X() method from B it request an object of type A.Customer. it's not accepting an object type of Customer .what might be the problem.any idea.
|
|
|
|
|