|
HI,
we have a web service and our application(.net 1.1, C#, oracle) consumes this web service. By default the security(authentication) is given anonymous, now as for security reasons we want to remove this option.
So lets say we use Integrated Windows Authentication. Doing so we would get Access Denied 401 error. On searching though it is found that we could pass few credentials and access the web service (this works fine)
What are the cons in providing user credentials in the code?
What are the steps to be followed to make a web service secure and accessible?
Is there a way that a web service can be accessed after removing anonymous access and not providing any credentials in the code?
gauthee
|
|
|
|
|
|
Thanks Balaji!
the article was helpul however it was just an abstract! Is there some sort of practical example so that it would be easy for us to relate!
gauthee
|
|
|
|
|
hi all... i am getting the following problem while connecting to the .mdf file
"failed to generate a user instance of SQL Server.
Only an integrated connection can generate a user instance.
The connection will be closed"
how to fix this error????????
|
|
|
|
|
|
Could someone tell me where to find a good server capture applicatio, i want to see what is post back to the server any time i make a request.
i just went to Adobe MAX and I saw someone using it, but i couldnt find the name of it.
thanks
|
|
|
|
|
I have a web app. where I take user information and create a business card image. My question is, How do I convert that jpeg image I have into a pdf?
|
|
|
|
|
From whatever image editor you're using for your jpg, you can convert the image into a pdf by going to the Print menu and selecting your pdf maker. I use Adobe Acrobat and highly recommend this, as it creates smaller, clearer files. However, there are also several free pdf creators on the intranet, such as www.primopdf.com, www.cutepdf.com, etc. If you're wanting to create the pdf automatically as part of the application, I'd need more information about what language you're coding your program in.
|
|
|
|
|
I'm actually using C# to work with my jpeg image. In fact hear is the code behind so you can get general idea as to what I'm talking about.
using System;
using System.IO;
using Microsoft.VisualBasic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Imaging;
using System.Design;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace TextOnImage
{
public partial class TextOnImage : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
//Load the Image to be written on.
Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("Wayland_Tmp_RGB.jpg"));
Graphics graphicImage = Graphics.FromImage( bitMapImage );
SolidBrush brush = new SolidBrush(Color.FromArgb(12,39,120));
//Code for Name.
FileStream file = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Name.txt",FileMode.OpenOrCreate,FileAccess.Read);
StreamReader name= new StreamReader(file);
//Code for Title1.
FileStream file1 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Title1.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader ttl1 = new StreamReader(file1);
//Code for Title2
FileStream file2 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Title2.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader ttl2 = new StreamReader(file2);
//Code for the Campus
FileStream file3 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Campus.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader cmp = new StreamReader(file3);
//Code for the CityStateZip
FileStream file4 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Line1.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader lin1 = new StreamReader(file4);
//Code for the Phone
FileStream file5 = new FileStream(@"C:\Inetpub\wwwroot\Wayland\ImageMaker\proof\Line2.txt", FileMode.OpenOrCreate, FileAccess.Read);
StreamReader lin2 = new StreamReader(file5);
//Code for the Fax
//Smooth graphics is nice.
//graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
//graphicImage.CompositingQuality= CompositingQuality.HighQuality;
graphicImage.TextRenderingHint= TextRenderingHint.ClearTypeGridFit;
//Reads the text file info.
string n=name.ReadLine();
string t1=ttl1.ReadLine();
string t2=ttl2.ReadLine();
string c=cmp.ReadLine();
string ln1=lin1.ReadLine();
string ln2=lin2.ReadLine();
int x;
string read = null;
if ((read=t1)!=null)
{
x=1215;
//Title#1
graphicImage.DrawString(t1.PadLeft(t1.Length), new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x-(t1.Length*12), 525));
//Name
x = x - (t1.Length*14);
graphicImage.DrawString(n, new Font("Garamond", 8, FontStyle.Bold), brush, new Point(x - (n.Length) * 16, 525));
}
else
{
x=1200;
//Name if there is no Title#1
graphicImage.DrawString(n, new Font("Garamond", 8, FontStyle.Bold), brush, new Point(x - (n.Length+2)*12 , 525));
}
//*****************************Title#2***And***Campus****************************************//
if (((read = t2) != null) & ((read = c) != null))
{
x = 1190;
//Title#2 if there is a Title#2
graphicImage.DrawString(t2, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (t2.Length) * 12, 575));
//Campus
x =1135;
graphicImage.DrawString(c, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (c.Length) * 12, 625));
}
//Code for Campus if there is now Title#2
else
{
if ((read = c) != null)
{
x = 1185;
graphicImage.DrawString(c, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (c.Length) * 12, 575));
}
else
{
//Title#2 if Campus is entered into Title@2
x=1215;
graphicImage.DrawString(t2, new Font("Garamond", 8, FontStyle.Italic), brush, new Point(x - (t2.Length) * 13, 575));
}
}
//**************************Line1****of**the**Card******************************************//
x=1200;
graphicImage.DrawString(ln1, new Font("Garamond", 7, FontStyle.Regular), brush, new Point(x - (ln1.Length) * 12, 700));
//**************************Line2****of**the**Card******************************************//
x = 1200;
graphicImage.DrawString(ln2, new Font("Garamond", 7, FontStyle.Regular), brush, new Point(x - (ln2.Length) * 12, 750));
//This code is to test the positioning of the information
// graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 525));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 575));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 625));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 675));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1200, 725));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(0, 525));
//graphicImage.DrawString("|", new Font("Garamond", 10, FontStyle.Bold), brush, new Point(1485, 525));
//Closing all files.
name.Close();
file.Close();
ttl1.Close();
file1.Close();
ttl2.Close();
file2.Close();
cmp.Close();
file3.Close();
lin1.Close();
file4.Close();
lin2.Close();
file5.Close();
//Set the content type
Response.ContentType="image/jpeg";
//Save the new image to the response output stream.
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
//Clean house.
graphicImage.Dispose();
bitMapImage.Dispose();
}
//private Brush Color()
//{
// throw new Exception("The method or operation is not implemented.");
// }
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
}
#endregion
}
}
I got the source code from someone in Code Project and kind of made my own thing with it, but like I said before the graphics dept. is unable to use the jpg image because when they convert it to cmyk all the brush strokes show up and we can't have that. Any suggestions at this point would be greatly appreciated.
Thanks,
Armando
|
|
|
|
|
It seems to me that you probably just want to create the PDF ahead of time, seeing as all these paths are hard coded. You also shouldn't be doing this sort of heavy lifting in your presentation layer.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
If I can some how raise the DpiX to 300, and the DpiY to 300 then I believe this will all work.
|
|
|
|
|
The DPI of a monitor is typically 72 or 96. DPI is actually just rendering metadata, it's got nothing to do with the file itself ( that is, it's independant of resolution )
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Ok, so how would I go about fixing the garbage around the text. I've tried playing around with the smoothe antialias option and things of that nature, but have had no new results.
|
|
|
|
|
antialiasing is different to noise removal. I don't even know what garbage you're talking about, is it on the jpeg, or just the PDF. DPI will not resolve this either, you need to work out what the noise is, and remove it.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
When you look at the image after the business card is produced it looks fine. The problem comes when the graphics dept. converts the image to cmyk which causes the Rasterizing of the image, and converting it to cmyk is a must if your going to print the card on the press' that we have. I'm just at a loss right now.
|
|
|
|
|
Hi
Can any 1 please describe the difference between Transform and Passthrough mode of Literal in ASP.Net 2.0...?
Regards
Sivan.G
|
|
|
|
|
From MSDN Library:
PassThrough
The contents of the control are not modified.
Encode
The contents of the control are converted to an HTML-encoded string.
Transform
Unsupported markup-language elements are removed from the contents of the control. If the Literal control is rendered on a browser that supports HTML or XHTML, the control's contents are not modified.
So, if the server can determine that the browser supports HTML or XHTML, there is no difference.
---
single minded; short sighted; long gone;
|
|
|
|
|
On my ASP.NET page, I have a Formview control, which contains several templates (ItemTemplate, etc).
I cannot seem to access any controls in those templates via code.
ie. Double-click a dropdownlist control and it generates a handler for SelectedItemChanged. However, that handler cannot see it's own control, nor any other control in the same template.
Intellisense just says they aren't defined.
I tried drilling down through formview1.ItemTemplate but it doesn't show any controls.
I must be missing something here.
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..."
|
|
|
|
|
Hi I have one COM Dll which needs to be used in my ASP Page. But it is giving Error like this:
Retrieving the COM class factory for component with CLSID {60527433-1464-42EF-A657-3ACE4390AF84} failed due to the following error: 80070005.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {60527433-1464-42EF-A657-3ACE4390AF84} failed due to the following error: 80070005.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true">, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 20: protected void Page_Load(object sender, EventArgs e)
Line 21: {
Line 22: objLICGen = new EsdLICGenLib.EsdLicenseGeneratorClass();Line 23:
Line 24: string strCon = ConfigurationSettings.AppSettings["strConnection"];
Source File: c:\Inetpub\wwwroot\ProductRegistration\frmProductRegistration.aspx.cs Line: 22
Can you Help me how to solve this Problem??
Thanks
..swamy
|
|
|
|
|
You're using a COM dll on the back end ? So, it's not something the client will see, right ?
What's the COM dll and why do you need it ?
ASP.NET cannot access your file system above the root of the web app. Your COM dll needs to be in your bin directory ( and regstered, of course ).
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I added my COM Dll Reference to my ASP Page and now it's in my bin directory ofcourse, but the actual problem araise when iam trying to create the object for my dll class.
Thanks & Regards
|
|
|
|
|
Hi,
I am little struggled with this ..
in my project i want to subtract date(may be moonth sometimes) value from current datetime using asp.net c# ..please anybody help me..
regards
alex.
|
|
|
|
|
see if this helps
System.DateTime.Now.AddDays(-5)
same thing with hours, months etc....
Sri
|
|
|
|
|
Hi,
Thanks ...
regards
alex.
|
|
|
|
|
ASP.net 2.0, Sharepoint2007
<zonetemplate>
<asp:declarativecatalogpart id="DeclarativeCatalogPart1" runat="server">
<webpartstemplate>
<uc1:calculator id="Calculator1" runat="server" title="Testing" exportmode="All">
------------------------------------------------------------------------------------------------------------------------
Calculator.ascx:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim gwp As GenericWebPart
gwp = Me.Parent
gwp.ExportMode = WebPartExportMode.All
End Sub
-----------------------------------------------------------------------------------------------------------------------
I added this to web.config in sharepoint site:
<safecontrol typename="*" safe="True" namespace="ASPNETWebPart" assembly="ASPNETWebPart">
and added the exported web part to the bin directory
-------------------------------------------------------------------
I imported calculator.webpart to sharepoint and I had the following error:
Unable to add selected web part(s). The <type> element is required.
Add this element to the Web Part file (.webpart), and then try to import the Web Part.
What did I do wrong
Thank you
|
|
|
|
|